28 lines
576 B
Docker
28 lines
576 B
Docker
# Data Retention Service
|
|
|
|
FROM node:18-alpine
|
|
|
|
# Create app directory
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install only production dependencies
|
|
RUN npm ci --only=production && npm cache clean --force# Copy source code
|
|
COPY . .
|
|
|
|
# Create non-root user
|
|
RUN addgroup -g 1001 -S nodejs
|
|
RUN adduser -S retention -u 1001
|
|
|
|
# Change ownership
|
|
RUN chown -R retention:nodejs /app
|
|
USER retention
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD node healthcheck.js
|
|
|
|
# Start the service
|
|
CMD ["node", "index.js"] |