dockerize

This commit is contained in:
2026-04-09 17:33:38 -05:00
parent b266a641e4
commit 6d3eefbeca
3 changed files with 58 additions and 0 deletions

22
Dockerfile Normal file
View File

@@ -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"]

27
docker-compose.yml Normal file
View File

@@ -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

9
nginx.conf Normal file
View File

@@ -0,0 +1,9 @@
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
location / {
try_files $uri $uri/ /index.html;
}
}