31 lines
600 B
Docker
31 lines
600 B
Docker
FROM node:18-alpine
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm install --silent
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Create non-root user
|
|
RUN addgroup -g 1001 -S nodejs
|
|
RUN adduser -S turftracker -u 1001
|
|
|
|
# Change ownership of the app directory
|
|
RUN chown -R turftracker:nodejs /app
|
|
USER turftracker
|
|
|
|
# Expose port
|
|
EXPOSE 3000
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://localhost:3000 || exit 1
|
|
|
|
# Start the application
|
|
CMD ["npm", "start"] |