build: add Dockerfile and .dockerignore for containerized deployment

This commit is contained in:
lingyuzeng
2026-03-22 18:41:15 +08:00
parent ce99e8b418
commit 6c097fceb2
2 changed files with 28 additions and 0 deletions

5
.dockerignore Executable file
View File

@@ -0,0 +1,5 @@
node_modules
dist
.env
.DS_Store
*.log

23
Dockerfile Executable file
View File

@@ -0,0 +1,23 @@
FROM node:20-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV PROXY_PORT=11437
ENV PROXY_HOST=0.0.0.0
COPY --from=builder /app/package.json ./
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
EXPOSE 11437
CMD ["node", "dist/index.js"]