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.
manager
Guillermo Pages 2 months ago
parent a286290f94
commit 8f55038e0f

@ -1,52 +1,20 @@
# syntax=docker/dockerfile:1.7 # ---- Base Node ----
FROM node:22-alpine AS base
# Stage 1: Dependencies RUN mkdir -p /app
FROM node:22-alpine AS deps
WORKDIR /app
# Copy package files
COPY package.json package-lock.json ./
# 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 WORKDIR /app
# Copy dependencies from deps stage COPY . .
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
ENV NODE_ENV=production RUN chown -R node:node /app
# Copy package files
COPY package.json package-lock.json ./
# Copy only production dependencies (from deps stage) USER node
COPY --from=deps /app/node_modules ./node_modules
# Copy built JavaScript files RUN npm i
COPY --from=builder /app/build ./build
# Run as non-root user RUN npm run build:prod
RUN chown -R node:node /app
USER node
# Expose the listening port # Expose the listening port of your app
EXPOSE 3000 EXPOSE 3000
CMD [ "npm", "start" ]
CMD ["node", "./build/src/index.js"]
Loading…
Cancel
Save