From 8f55038e0f52e42ebbf82bee3c9a410d9a3063a6 Mon Sep 17 00:00:00 2001 From: Guillermo Pages Date: Thu, 23 Oct 2025 16:22:27 +0200 Subject: [PATCH] revert: restore simple Dockerfile from 72243c5 The multi-stage Dockerfile was causing build failures due to swissoid-back local dependency issues. Reverting to the working simple Dockerfile while keeping the BuildKit cache configuration in .drone.yml. --- Dockerfile | 52 ++++++++++------------------------------------------ 1 file changed, 10 insertions(+), 42 deletions(-) diff --git a/Dockerfile b/Dockerfile index 21c1c63..663e165 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,52 +1,20 @@ -# syntax=docker/dockerfile:1.7 +# ---- Base Node ---- +FROM node:22-alpine AS base -# Stage 1: Dependencies -FROM node:22-alpine AS deps -WORKDIR /app - -# Copy package files -COPY package.json package-lock.json ./ +RUN mkdir -p /app -# Install ALL dependencies (including devDependencies for build) -RUN --mount=type=cache,target=/root/.npm \ - npm ci --no-audit --no-fund - -# Stage 2: Build -FROM node:22-alpine AS builder WORKDIR /app -# Copy dependencies from deps stage -COPY --from=deps /app/node_modules ./node_modules - -# Copy source code and config files -COPY package.json package-lock.json ./ -COPY tsconfig*.json ./ -COPY src ./src - -# Build TypeScript to JavaScript with cache mount -RUN --mount=type=cache,target=/tmp/.tsc-cache \ - npm run build:prod - -# Stage 3: Runtime -FROM node:22-alpine AS runner -WORKDIR /app +COPY . . -ENV NODE_ENV=production - -# Copy package files -COPY package.json package-lock.json ./ +RUN chown -R node:node /app -# Copy only production dependencies (from deps stage) -COPY --from=deps /app/node_modules ./node_modules +USER node -# Copy built JavaScript files -COPY --from=builder /app/build ./build +RUN npm i -# Run as non-root user -RUN chown -R node:node /app -USER node +RUN npm run build:prod -# Expose the listening port +# Expose the listening port of your app EXPOSE 3000 - -CMD ["node", "./build/src/index.js"] +CMD [ "npm", "start" ] \ No newline at end of file