Giancarmine Salucci dcaf485131
All checks were successful
Build and publish farmacia-bot images / Build and push client's image to Gitea's registry (push) Successful in 16s
Build and publish farmacia-bot images / deploy_ovh (push) Successful in 18s
single stage Dockerfile
2025-04-15 13:23:52 +02:00

31 lines
800 B
Docker

FROM node:23-alpine
# Create a non-root user
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
# Set working directory
WORKDIR /home/appuser/app
# Copy package files with correct ownership
COPY --chown=appuser:appgroup package*.json ./
# Install dependencies
RUN npm install
# Copy application files with correct ownership
COPY --chown=appuser:appgroup main.js util.js worker.js ./
# Create logs directory with correct permissions
RUN mkdir -p logs && chown -R appuser:appgroup logs
# Expose logs directory as a volume
VOLUME ["/home/appuser/app/logs"]
# Use an environment variable for thread count (default to 0 to use auto)
ENV THREAD_COUNT=0
# Switch to non-root user
USER appuser
# Run the application - using JSON array format
CMD ["sh", "-c", "node main.js ${THREAD_COUNT}"]