refactor: clone repo from Gitea in Dockerfile instead of COPY
Replace local COPY with git clone --depth 1 so the image can be built without a local source context. Adds BRANCH build arg (default: main).
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
FROM node:alpine AS build
|
||||
|
||||
WORKDIR /app
|
||||
RUN apk add --no-cache git
|
||||
|
||||
COPY package.json package-lock.json tsconfig.json ./
|
||||
COPY packages/shared/ packages/shared/
|
||||
COPY apps/server/ apps/server/
|
||||
ARG BRANCH=main
|
||||
WORKDIR /app
|
||||
RUN git clone --branch ${BRANCH} --depth 1 https://gitea.gilmour109.de/Gilmour109/calchat.git .
|
||||
|
||||
RUN npm ci --workspace=@calchat/server --workspace=@calchat/shared --include-workspace-root
|
||||
|
||||
@@ -15,9 +15,9 @@ FROM node:alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
COPY packages/shared/package.json packages/shared/
|
||||
COPY apps/server/package.json apps/server/
|
||||
COPY --from=build /app/package.json /app/package-lock.json ./
|
||||
COPY --from=build /app/packages/shared/package.json packages/shared/
|
||||
COPY --from=build /app/apps/server/package.json apps/server/
|
||||
|
||||
RUN npm ci --omit=dev --workspace=@calchat/server --workspace=@calchat/shared --include-workspace-root
|
||||
|
||||
|
||||
Reference in New Issue
Block a user