fix(docker): resolve @cc-platform/server file: dep in container build

Use additional_contexts to copy platform server package into the Docker
build context. Rewrites the file: dependency path and removes the
lockfile so npm install can resolve the local package correctly.
This commit is contained in:
MayaTheShy
2026-03-28 22:35:39 -04:00
parent 021b351248
commit c3344288a8
2 changed files with 12 additions and 1 deletions

View File

@@ -1,6 +1,9 @@
services: services:
server: server:
build: ./server build:
context: ./server
additional_contexts:
platform-server: ../../cc-platform-core/server
networks: networks:
- inventory-network - inventory-network
volumes: volumes:

View File

@@ -8,8 +8,16 @@ RUN apk add --no-cache python3 make g++ su-exec libstdc++
WORKDIR /app 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 package*.json ./ COPY package*.json ./
# Rewrite file: dependency to use the local copy inside the container
RUN sed -i 's|file:../../../cc-platform-core/server|file:./platform-server|' package.json \
&& rm -f package-lock.json
RUN npm install --omit=dev RUN npm install --omit=dev
# Remove build tools after install to keep image small # Remove build tools after install to keep image small