homebrewery-docker/Dockerfile
Florian 74a4557724
All checks were successful
Building and publishing Homebrewery as Docker Image / build (release) Successful in 11m51s
Refactor environment variable handling in Dockerfile and entrypoint.sh for consistency and clarity
2025-06-25 21:08:49 +02:00

60 lines
2.0 KiB
Docker

# Base Stage for NodeJS
FROM --platform=$BUILDPLATFORM node:22-alpine AS buildhelper
ENV NODE_ENV=docker
WORKDIR /usr/src/app
# Installing dependencies with use of package-lock.json
FROM buildhelper AS deps
RUN apk --no-cache add git
COPY homebrewery/package.json homebrewery/package-lock.json ./
RUN npm ci --ignore-scripts
# Build Stage
FROM buildhelper AS builder
COPY --from=deps /usr/src/app/node_modules ./node_modules
COPY homebrewery/ ./
RUN npm run build
FROM --platform=$TARGETPLATFORM node:22-alpine AS runner
ENV NODE_ENV=docker
WORKDIR /usr/src/app
ARG VERSION
ARG REVISION
ARG CREATED_AT
LABEL org.opencontainers.image.authors="F.Weber <kosmos@morlana.net>"
LABEL org.opencontainers.image.url="https://git.morlana.online/f.weber/homebrewery-docker/src/branch/main/README.md"
LABEL org.opencontainers.image.documentation="https://git.morlana.online/f.weber/homebrewery-docker/src/branch/main/README.md"
LABEL org.opencontainers.image.source="https://git.morlana.online/f.weber/homebrewery-docker"
LABEL org.opencontainers.image.version="${VERSION}"
LABEL org.opencontainers.image.revision="${REVISION}"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.created="${CREATED_AT}"
# Defining env variables for homebrewery
ENV HB_HOST=homebrewery.local.naturalcrit.com:8000 HB_NATURALCRIT_URL=local.naturalcrit.com:8010 HB_SECRET=secret PORT=8000 HB_ENABLE_V3=true
ENV HB_ENABLE_THEMES=true HB_PUBLIC_URL=https://homebrewery.naturalcrit.com HB_DB_URI=mongodb://mongodb/homebrewery
ENV HB_IMAGES=null HB_FONTS=null
# Adding tini for clean signal handling
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
# Adding Entrypoint
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Adding executables
COPY --from=deps /usr/src/app/node_modules ./node_modules
COPY --from=builder /usr/src/app/build ./build
COPY homebrewery/ ./
EXPOSE 8000
ENTRYPOINT ["/entrypoint.sh"]