FROM node:20-alpine
# Install necessary tools
RUN apk add --no-cache wget net-tools procps
WORKDIR /app
# Copy package.json and package-lock.json (if available)
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy source code
COPY . .
# Build the application
RUN npm run build
# Set environment variables
ENV NODE_ENV=production
# Make the entrypoint script executable
RUN chmod +x /app/docker-entrypoint.sh
# Use the entrypoint script
ENTRYPOINT ["/app/docker-entrypoint.sh"]