single stage Dockerfile
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

This commit is contained in:
Giancarmine Salucci 2025-04-15 13:23:52 +02:00
parent bd053cfb73
commit dcaf485131

View File

@ -1,33 +1,19 @@
# Build stage
FROM node:23-alpine AS builder
# Set working directory for the build stage
WORKDIR /build
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy application files
COPY . .
# Runtime stage
FROM node:23-alpine AS runtime
FROM node:23-alpine
# Create a non-root user
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
# Set working directory for the application
# Set working directory
WORKDIR /home/appuser/app
# Copy only the necessary files from the builder stage
COPY --from=builder --chown=appuser:appgroup /build/package*.json ./
COPY --from=builder --chown=appuser:appgroup /build/main.js ./
COPY --from=builder --chown=appuser:appgroup /build/util.js ./
COPY --from=builder --chown=appuser:appgroup /build/worker.js ./
COPY --from=builder --chown=appuser:appgroup /build/node_modules ./node_modules
# 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