build(docker): add Dockerfile with nginx for production deployment

This commit is contained in:
devcodetools committed 2026-09-13 18:18:08 +02:00
1 parent 8523ace11f
commit 8d6d923063
3 files changed
+49

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
node_modules
dist
coverage
.git
.gitignore
Dockerfile
docker-compose*.yml
*.md
+22
View File
@@ -0,0 +1,22 @@
FROM node:22-alpine AS build
WORKDIR /app
RUN corepack enable
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
RUN pnpm install --frozen-lockfile
COPY public ./public
COPY . .
RUN pnpm build
FROM nginx:1.27-alpine AS production
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
+19
View File
@@ -0,0 +1,19 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
gzip on;
gzip_types text/plain text/css application/json application/javascript image/svg+xml;
location / {
try_files $uri $uri/ /index.html;
}
location ~* \.(?:js|css|png|jpg|jpeg|gif|svg|ico|woff2?)$ {
expires 30d;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
}