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. Applied to both production and dev Dockerfiles.
This commit is contained in:
@@ -3,12 +3,20 @@ FROM node:18-alpine
|
||||
|
||||
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
|
||||
|
||||
# Install nodemon for hot reload
|
||||
RUN npm install -g nodemon
|
||||
|
||||
# Copy package files
|
||||
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
|
||||
|
||||
# Install all dependencies (including dev)
|
||||
RUN npm install
|
||||
|
||||
|
||||
Reference in New Issue
Block a user