Dockerfile and nginx added

This commit is contained in:
miwr 2025-04-07 12:48:29 +02:00
parent bdde7897a9
commit ec469f7e2b
2 changed files with 25 additions and 0 deletions

13
Dockerfile Normal file
View file

@ -0,0 +1,13 @@
FROM node:lts-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install --legacy-peer-deps # or yarn install
COPY . .
RUN npm run build --prod
FROM nginx:alpine
RUN rm /etc/nginx/conf.d/default.conf
COPY --from=builder /app/dist/silly-game-frontend /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/conf.d/my-angular-app.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

12
nginx.conf Normal file
View file

@ -0,0 +1,12 @@
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html/browser; # This is crucial!
index index.html index.html;
try_files $uri $uri/ /index.html; # For Angular routing
}
# Optional: Add other configurations like gzip, headers, etc.
}