Add Docker Support

This commit is contained in:
2025-10-24 12:41:33 -07:00
parent 8ce8c25442
commit 6b89480377
3 changed files with 64 additions and 0 deletions

33
DockerFile Normal file
View File

@@ -0,0 +1,33 @@
# --- Build stage (if you transpile; otherwise this is basically a no-op)
FROM node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
# If you transpile (TS/webpack/etc.), do it here:
# RUN npm run build
# --- Runtime stage
FROM node:20-alpine
ENV NODE_ENV=production
# Avoid running as root
RUN addgroup -S nodegrp && adduser -S nodeusr -G nodegrp
WORKDIR /app
# Copy only what's needed at runtime
COPY --from=build /app/package*.json ./
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/. ./
# If your compiled output lives in /app/dist:
# WORKDIR /app/dist
# Healthcheck (customize the path/port if needed)
HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
CMD wget -qO- http://127.0.0.1:80/health || exit 1
USER nodeusr
EXPOSE 80
EXPOSE 443
# Ensure your server listens on 0.0.0.0:80 inside the container
CMD ["npm", "start"]