diff --git a/README.md b/README.md index 492d7c5..392df63 100644 --- a/README.md +++ b/README.md @@ -7,15 +7,26 @@ ## Running locally +### 1. Copy environment file (defaults work out of the box) ```bash -# 1. Copy environment file (defaults work out of the box) cp .env-template .env +``` + +### 2. Start the application + +#### 2.1. Full +```bash +docker compose -f infrastructure/local/docker-compose.yaml --profile full up -d +``` -# 2. Start infrastructure (PostgreSQL + Keycloak) +#### 2.2 Backend + its infrastructure (PostgreSQL + Keycloak) +```bash docker compose -f infrastructure/local/docker-compose.yaml --profile backend up -d +``` -# 3. Backend -cd skyroster-backend -./mvnw spring-boot:run + +#### 2.3 Frontend + its infrastructure (PostgreSQL + Keycloak) +```bash +docker compose -f infrastructure/local/docker-compose.yaml --profile frontend up -d ``` diff --git a/infrastructure/local/docker-compose.yaml b/infrastructure/local/docker-compose.yaml index 2ad4b7b..3747e15 100644 --- a/infrastructure/local/docker-compose.yaml +++ b/infrastructure/local/docker-compose.yaml @@ -2,8 +2,11 @@ services: postgres: image: postgres:17 container_name: skyroster-db + networks: + - skyroster-network profiles: - db + - frontend - backend - full environment: @@ -24,7 +27,10 @@ services: keycloak: image: quay.io/keycloak/keycloak:26.2 container_name: skyroster-keycloak + networks: + - skyroster-network profiles: + - frontend - backend - full environment: @@ -43,5 +49,53 @@ services: postgres: condition: service_healthy + frontend: + build: + context: ../../skyroster-frontend + args: + VITE_API_URL: http://localhost:8000 + container_name: skyroster-frontend + networks: + - skyroster-network + profiles: + - frontend + - full + ports: + - "5173:80" + volumes: + - ../../skyroster-frontend:/app + - /app/node_modules + restart: unless-stopped + depends_on: + postgres: + condition: service_healthy + keycloak: + condition: service_started + + backend: + build: + context: ../../skyroster-backend + container_name: skyroster-backend + networks: + - skyroster-network + profiles: + - backend + - full + ports: + - "8001:8001" + environment: + SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${DB_NAME:-skyroster} + SPRING_DATASOURCE_USERNAME: ${DB_USERNAME:-skyroster} + SPRING_DATASOURCE_PASSWORD: ${DB_PASSWORD:-skyroster} + depends_on: + postgres: + condition: service_healthy + keycloak: + condition: service_started + volumes: - pgdata: \ No newline at end of file + pgdata: + +networks: + skyroster-network: + driver: bridge \ No newline at end of file diff --git a/skyroster-backend/Dockerfile b/skyroster-backend/Dockerfile index 4e6abc1..ac4ec3e 100644 --- a/skyroster-backend/Dockerfile +++ b/skyroster-backend/Dockerfile @@ -1,5 +1,7 @@ # Stage 1: Build FROM eclipse-temurin:25-jdk AS build +LABEL authors="Bartosz Janusz, Maksymilian Krywionek, Marcin Kuduk, Łukasz Lizak" + WORKDIR /app # Copy Maven wrapper and POM for dependency caching diff --git a/skyroster-backend/mvnw b/skyroster-backend/mvnw old mode 100644 new mode 100755 diff --git a/skyroster-frontend/Dockerfile b/skyroster-frontend/Dockerfile index 584b8ee..2f8a3a1 100644 --- a/skyroster-frontend/Dockerfile +++ b/skyroster-frontend/Dockerfile @@ -1,11 +1,17 @@ # Stage 1: Build FROM node:22-alpine AS build +LABEL authors="Bartosz Janusz, Maksymilian Krywionek, Marcin Kuduk, Łukasz Lizak" + WORKDIR /app COPY package.json package-lock.json ./ RUN npm ci COPY . . + +ARG VITE_API_URL +ENV VITE_API_URL=$VITE_API_URL + RUN npm run build # Stage 2: Runtime @@ -14,3 +20,5 @@ COPY --from=build /app/dist /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"]