Refactor Dockerfile to unify base image references and improve clarity in build stages
All checks were successful
Building and publishing Homebrewery as Docker Image / build (release) Successful in 11m48s

This commit is contained in:
Florian Weber 2025-06-25 17:11:45 +02:00
parent 4b6efcea6e
commit 9960e05315
Signed by: f.weber
GPG Key ID: A1C85EB19014A2D3

View File

@ -1,24 +1,27 @@
# Base Stage for NodeJS # Base Stage for NodeJS
FROM node:22-alpine AS base FROM --platform=$BUILDPLATFORM node:22-alpine AS buildhelper
ENV NODE_ENV=docker ENV NODE_ENV=docker
WORKDIR /usr/src/app WORKDIR /usr/src/app
# Installing dependencies with use of package-lock.json # Installing dependencies with use of package-lock.json
FROM base AS deps FROM buildhelper AS deps
RUN apk --no-cache add git RUN apk --no-cache add git
COPY homebrewery/package.json homebrewery/package-lock.json ./ COPY homebrewery/package.json homebrewery/package-lock.json ./
RUN npm ci --ignore-scripts RUN npm ci --ignore-scripts
# Build Stage # Build Stage
FROM base AS builder FROM buildhelper AS builder
COPY --from=deps /usr/src/app/node_modules ./node_modules COPY --from=deps /usr/src/app/node_modules ./node_modules
COPY homebrewery/ ./ COPY homebrewery/ ./
RUN npm run build RUN npm run build
FROM base AS runner FROM --platform=$TARGETPLATFORM node:22-alpine AS runner
ENV NODE_ENV=docker
WORKDIR /usr/src/app
ARG VERSION ARG VERSION
ARG REVISION ARG REVISION