Skip to content

Docker Documentation

CengizBilalSari edited this page May 14, 2025 · 1 revision

Full-Stack Application Docker Setup

This documentation explains how to build and run a full-stack application using Docker in our project. The setup consists of a React frontend and a Java (Spring Boot) backend, each containerized and connected via Docker Compose.


🗂️ Project Structure

project-root/
│
├── backend/
│   ├── Dockerfile # Multi-stage Dockerfile for Spring Boot
│   ├── pom.xml
│   └── src/
│
├── frontend/
│   ├── Dockerfile # Dockerfile for React app
│   ├── package.json
│   ├── package-lock.json
│   └── src/
│
└── docker-compose.yml # Docker Compose config

Frontend Service

Dockerfile (frontend/Dockerfile):

FROM node:latest
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "start"]

Description:

  • Node.js based frontend

  • Optimized dependency installation

  • Serves on port 3000

Backend Service

Dockerfile (backend /Dockerfile):

# Stage 1: Build
FROM maven:latest AS build
WORKDIR /app
COPY pom.xml .
RUN mvn dependency:go-offline
COPY src ./src
RUN mvn package -DskipTests

# Stage 2: Run
FROM openjdk:21-jdk
WORKDIR /app
COPY --from=build /app/target/*.jar app.jar
ENTRYPOINT ["java", "-jar", "app.jar"]

Description:

  • Multi-stage Java/Spring Boot build

  • Maven for dependency management

  • OpenJDK 21 runtime

  • Runs as executable JAR

Docker Compose

DockerComposeFile (/docker-compose.yml):


version: '3.8'

services:
  backend:
    build: ./backend
    ports:
      - "8080:8080"
    networks:
      - appnet

  frontend:
    build: ./frontend
    ports:
      - "3000:3000"
    networks:
      - appnet
    depends_on:
      - backend

networks:
  appnet:

Network

  • Both services are connected via a Docker network named appnet to enable communication.

🔁 Service Dependency

  • The frontend service depends on backend and will wait until the backend is ready.

Build and Run Instructions

  • Navigate to the root directory of the project.

  • Build and run containers using Docker Compose: -docker-compose up --build

  • Access the app: -Frontend (React): http://<deployed_url>:3000/ -Backend (Spring Boot): http://<deployed_url>:8080/

🧼 Cleanup

  • To stop and remove the containers and network:
    • docker-compose down

BOUNSWE'25 - Group5

WasteLess App

Milestones

✍️ Meeting Notes

📋 Team Meeting Notes

🛠️ Backend Meeting Notes
💻 Frontend Meeting Notes
📱 Mobile Meeting Notes

🧪 Lab Reports

📏 Plan

📌 CMPE451 Project

🚀 Weekly Reports

Abdurrahman Arslan
Abdülkerim Kasar
Ali Bartu Konca
Arda Yalçındağ
Cengiz Bilal Sarı
Emre Kılıç
Osman Yusuf Tosun
Serdar Bahar
Yusuf Onur Öksüz
Yüksel Eren Şen

📦 Templates

📌 Standards

🗂️ Archive

⌛ 352 Sidebar

🏠 Home

🚀 Contributors

📌 Team Members and Contributions

⛳️ Milestones

✍️ Meeting Notes

📋 Team Meeting Notes

🛠️ Backend Meeting Notes
💻 Frontend Meeting Notes
📱 Mobile Meeting Notes

📋 Team Documentations

Project

📌 Project Requirements, Scenarios, Elicitation Questions
📌 Software Design Diagrams 📌 Drafts

📚 Resources

📌 Resources Used During the Project

🔍 Research

📌 Research Documentations

📦 Templates

Clone this wiki locally