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
parent
a286290f94
commit
8f55038e0f
@ -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" ]
|
||||
Loading…
Reference in New Issue