mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-11 16:45:13 +00:00
# Which Problems Are Solved The broken login image is fixed. # How the Problems Are Solved The most important learnings from https://github.com/zitadel/zitadel/pull/10318 are applied: - Path in entrypoint is fixed: `exec node /runtime/apps/login/server.js` - .dockerignore is updated so CSS styles are built into the image - `source: .` is passed to the docker-bake action. Without this, docker-bake builds from a remote context, which seems to be slow and not updated on new PR commits. Looks like the bake action uploads an artifact that [conflicts with the compile workflow](https://github.com/zitadel/zitadel/actions/runs/16620417216/job/47023478437). Therefore, a pattern is added to the compile workflow so only relevant artifacts are selected.
46 lines
1.9 KiB
Docker
46 lines
1.9 KiB
Docker
FROM node:20-alpine AS base
|
|
|
|
FROM base AS build
|
|
ENV PNPM_HOME="/pnpm"
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
RUN corepack enable && COREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack prepare [email protected] --activate && \
|
|
apk update && apk add --no-cache && \
|
|
rm -rf /var/cache/apk/*
|
|
WORKDIR /app
|
|
COPY pnpm-lock.yaml pnpm-workspace.yaml ./
|
|
RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store pnpm fetch --frozen-lockfile \
|
|
--filter @zitadel/login \
|
|
--filter @zitadel/client \
|
|
--filter @zitadel/proto
|
|
COPY package.json ./
|
|
COPY apps/login/package.json ./apps/login/package.json
|
|
COPY packages/zitadel-proto/package.json ./packages/zitadel-proto/package.json
|
|
COPY packages/zitadel-client/package.json ./packages/zitadel-client/package.json
|
|
RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store pnpm install --frozen-lockfile \
|
|
--filter @zitadel/login \
|
|
--filter @zitadel/client \
|
|
--filter @zitadel/proto
|
|
COPY . .
|
|
RUN pnpm turbo build:login:standalone
|
|
|
|
FROM scratch AS build-out
|
|
COPY /apps/login/public ./apps/login/public
|
|
COPY --from=build /app/apps/login/.next/standalone ./
|
|
COPY --from=build /app/apps/login/.next/static ./apps/login/.next/static
|
|
|
|
FROM base AS login-standalone
|
|
WORKDIR /runtime
|
|
RUN addgroup --system --gid 1001 nodejs && \
|
|
adduser --system --uid 1001 nextjs
|
|
# If /.env-file/.env is mounted into the container, its variables are made available to the server before it starts up.
|
|
RUN mkdir -p /.env-file && touch /.env-file/.env && chown -R nextjs:nodejs /.env-file
|
|
COPY --chown=nextjs:nodejs apps/login/scripts ./
|
|
COPY --chown=nextjs:nodejs --from=build-out . .
|
|
USER nextjs
|
|
ENV HOSTNAME="0.0.0.0"
|
|
ENV PORT=3000
|
|
# TODO: Check healthy, not ready
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD ["/bin/sh", "-c", "node ./healthcheck.js http://localhost:${PORT}/ui/v2/login/healthy"]
|
|
ENTRYPOINT ["./entrypoint.sh"]
|