From badde913364d16e2d7087f252a438eb058102f95 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Sat, 28 Mar 2026 22:37:57 -0400 Subject: [PATCH] fix(docker): clone platform from git instead of additional_contexts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The additional_contexts approach required cc-platform-core to exist on the Docker host at a relative path. This fails on servers where the repo layout differs. Instead, use a multi-stage build: stage 1 clones cc-platform-core from Gitea (depth 1), stage 2 copies server/ into the app and rewrites the file: path. Fully self-contained — no host deps. --- web/docker-compose.yml | 5 +---- web/server/Dockerfile | 15 +++++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/web/docker-compose.yml b/web/docker-compose.yml index 05e4eb9..90d43f7 100644 --- a/web/docker-compose.yml +++ b/web/docker-compose.yml @@ -1,9 +1,6 @@ services: server: - build: - context: ./server - additional_contexts: - platform-server: ../../cc-platform-core/server + build: ./server networks: - inventory-network volumes: diff --git a/web/server/Dockerfile b/web/server/Dockerfile index 1c3fb49..3837487 100644 --- a/web/server/Dockerfile +++ b/web/server/Dockerfile @@ -1,4 +1,12 @@ -# Node.js backend +# Stage 1: Fetch platform server package from git +FROM alpine:3.20 AS platform +RUN apk add --no-cache git +ARG PLATFORM_REPO=https://git.spatulaa.com/MayaTheShy/cc-platform-core.git +ARG PLATFORM_BRANCH=master +RUN git clone --depth 1 --branch "$PLATFORM_BRANCH" "$PLATFORM_REPO" /src \ + && rm -rf /src/server/node_modules /src/.git + +# Stage 2: Node.js backend FROM node:20-alpine # Build tools needed for better-sqlite3 native compilation @@ -8,9 +16,8 @@ RUN apk add --no-cache python3 make g++ su-exec libstdc++ WORKDIR /app -# Copy platform server package from additional build context -COPY --from=platform-server . /app/platform-server/ -RUN rm -rf /app/platform-server/node_modules +# Copy platform server package from the git-clone stage +COPY --from=platform /src/server /app/platform-server/ COPY package*.json ./