freealberta/map/app/Dockerfile

38 lines
788 B
Docker

FROM node:18-alpine
# Install wget and dumb-init for proper signal handling
RUN apk add --no-cache wget dumb-init
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci --only=production && npm cache clean --force
# Copy application files
COPY server.js ./
COPY public ./public
COPY routes ./routes
COPY services ./services
COPY config ./config
COPY controllers ./controllers
COPY middleware ./middleware
COPY utils ./utils
COPY templates ./templates
# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001
# Change ownership
RUN chown -R nodejs:nodejs /app
USER nodejs
EXPOSE 3000
# Use dumb-init to handle signals properly and prevent zombie processes
ENTRYPOINT ["dumb-init", "--"]
CMD ["node", "server.js"]