diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9c891c2 --- /dev/null +++ b/Dockerfile @@ -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;"] \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..8c96b4c --- /dev/null +++ b/nginx.conf @@ -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. +} \ No newline at end of file