A deploy workflow, started only by hand (or through the API) and only from master, pulls the chosen image (release tag, sha or latest) and runs that image's own update.sh against VM103's compose directory through the Docker socket. update.sh now copies the database through the running server first, installs the image's compose.yaml and update.sh with --install, and restores the previous compose file together with the previous image when the new version does not come up. CI also builds release tags v*. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
56 lines
2.7 KiB
Docker
56 lines
2.7 KiB
Docker
# One image, four processes (server, driver, executor, model); the compose file picks the command.
|
|
# Backend runs TypeScript natively on Node 24 (type stripping): no build step, only the frontend is bundled.
|
|
ARG NODE_IMAGE=node:24-slim@sha256:2fe369e969550cde8e867afc3fe370b260140cab4a23d467074295b42163d553
|
|
# Static docker client and compose plugin for the driver. It talks to a read-only socket proxy (DOCKER_HOST), never to the socket.
|
|
ARG DOCKER_CLI_IMAGE=docker:28.5.2-cli@sha256:625d9431a9f54c5a2bc90f24f0e1c3d55b1349fd857dd85035f98c2c9acbdd4d
|
|
|
|
# The claude CLI for the model sidecar, pinned and updated deliberately (docs/DESIGN.md, "Wykonawcy modeli").
|
|
ARG CLAUDE_CODE_VERSION=2.1.267
|
|
# The codex CLI for the model sidecar, pinned and updated deliberately (docs/DESIGN.md, "Wykonawcy modeli").
|
|
ARG CODEX_VERSION=0.156.1
|
|
|
|
FROM ${DOCKER_CLI_IMAGE} AS dockercli
|
|
|
|
FROM ${NODE_IMAGE} AS claude
|
|
ARG CLAUDE_CODE_VERSION
|
|
RUN npm install --global --prefix /opt/claude "@anthropic-ai/claude-code@${CLAUDE_CODE_VERSION}" && npm cache clean --force
|
|
|
|
FROM ${NODE_IMAGE} AS codex
|
|
ARG CODEX_VERSION
|
|
RUN npm install --global --prefix /opt/codex "@openai/codex@${CODEX_VERSION}" && npm cache clean --force
|
|
|
|
FROM ${NODE_IMAGE} AS build
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci
|
|
COPY tsconfig.json vite.config.ts ./
|
|
COPY src ./src
|
|
RUN npm run build:web
|
|
|
|
FROM ${NODE_IMAGE} AS runtime
|
|
ARG REVISION=unknown
|
|
# Shown in the app's footer: the branch and the CI build number (empty in a local build).
|
|
ARG BRANCH=
|
|
ARG BUILD_NUMBER=
|
|
LABEL org.opencontainers.image.title="homelab-upgrade" org.opencontainers.image.revision="${REVISION}"
|
|
ENV BUILD_BRANCH=${BRANCH} BUILD_NUMBER=${BUILD_NUMBER} BUILD_REVISION=${REVISION}
|
|
ENV NODE_ENV=production HOST=0.0.0.0 PORT=8080 DB_PATH=/data/queue.sqlite WEB_DIR=/app/dist/web
|
|
WORKDIR /app
|
|
# bubblewrap for the function-runtime sidecar: without it the runtime refuses to run functions (no unsandboxed fallback).
|
|
RUN apt-get update && apt-get install -y --no-install-recommends bubblewrap git openssh-client && rm -rf /var/lib/apt/lists/*
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --omit=dev && npm cache clean --force
|
|
COPY --from=build /app/dist/web ./dist/web
|
|
COPY --from=dockercli /usr/local/bin/docker /usr/local/bin/docker
|
|
COPY --from=dockercli /usr/local/libexec/docker/cli-plugins/docker-compose /usr/local/libexec/docker/cli-plugins/docker-compose
|
|
COPY --from=claude /opt/claude /opt/claude
|
|
COPY --from=codex /opt/codex /opt/codex
|
|
COPY bin ./bin
|
|
COPY src ./src
|
|
COPY config ./config
|
|
# The deploy workflow runs this image's own update.sh against VM103's compose directory (docs/DEPLOY.md).
|
|
COPY deploy/compose.yaml deploy/update.sh ./deploy/
|
|
RUN chmod -R a+rX ./src ./config ./bin ./deploy
|
|
USER node
|
|
CMD ["node", "src/main/server.ts"]
|