diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c4f0df0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +# Stage 1: Build +FROM node:22-alpine AS build +WORKDIR /app +# Dependencies installieren (Caching nutzen) +COPY package*.json ./ +RUN npm install +# Code kopieren und bauen (kopiert dank nest-cli.json auch die .hbs/.assets) +COPY . . +RUN npm run build + +# Stage 2: Production Run +FROM node:22-alpine +WORKDIR /app +# Nur Production-Dependencies installieren (hält das Image extrem klein!) +COPY package*.json ./ +RUN npm install --omit=dev +# Kompilierten Code aus Stage 1 übernehmen +COPY --from=build /app/dist ./dist + +# NestJS Standard-Port +EXPOSE 3000 +CMD ["node", "dist/main"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..3f4137d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,27 @@ +services: + frontend: + build: + context: ./ # Pfad zu deinem Angular-Ordner anpassen + container_name: bayarea-frontend + restart: unless-stopped + ports: + - "3072:80" + networks: + - bayarea-network + + backend: + build: + context: ./api # Pfad zu deinem NestJS-Ordner anpassen + container_name: bayarea-backend + restart: unless-stopped + environment: + - PORT=3000 + # Hier kannst du später Datenbank-URLs (z.B. DATABASE_URL) eintragen + ports: + - "3073:3000" # Host 3073 -> Container 3000 + networks: + - bayarea-network + +networks: + bayarea-network: + driver: bridge \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..3be5b4a --- /dev/null +++ b/nginx.conf @@ -0,0 +1,9 @@ +server { + listen 80; + server_name localhost; + root /usr/share/nginx/html; + + location / { + try_files $uri $uri/ /index.html; + } +} \ No newline at end of file