Add Docker setup for Nginx serving built Node app

Introduce a multi-stage Dockerfile to build and serve a Node.js application using Nginx. Define a custom Nginx configuration for optimized static file handling and enable gzip compression.
This commit is contained in:
Вячеслав 2025-10-29 21:47:59 +05:00
parent 15db906f33
commit f94c90456f
2 changed files with 62 additions and 0 deletions

11
Dockerfile Normal file
View file

@ -0,0 +1,11 @@
FROM node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
FROM nginx:stable
COPY --from=build /app/dist /usr/share/nginx/html
COPY .docker/app/nginx/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80