feat: add deploy pipeline and switch Dockerfile to COPY-based build
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
Add deploy_server Drone pipeline that builds and pushes the Docker image to Gitea Container Registry, then deploys to VPS via SSH. Switch Dockerfile from git clone to COPY-based build for CI compatibility and better layer caching. Change exposed port to 3001.
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
FROM node:alpine AS build
|
||||
|
||||
RUN apk add --no-cache git
|
||||
|
||||
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
|
||||
COPY package.json package-lock.json ./
|
||||
COPY packages/shared/package.json ./packages/shared/
|
||||
COPY apps/server/package.json ./apps/server/
|
||||
|
||||
RUN npm run build --workspace=@calchat/shared && \
|
||||
npm run build --workspace=@calchat/server
|
||||
RUN npm ci -w @calchat/server -w @calchat/shared --include-workspace-root
|
||||
|
||||
COPY packages/shared/ packages/shared/
|
||||
COPY apps/server/ apps/server/
|
||||
|
||||
RUN npm run build -w @calchat/shared && npm run build -w @calchat/server
|
||||
|
||||
FROM node:alpine
|
||||
|
||||
@@ -19,11 +21,11 @@ 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
|
||||
RUN npm ci --omit=dev -w @calchat/server -w @calchat/shared
|
||||
|
||||
COPY --from=build /app/packages/shared/dist/ packages/shared/dist/
|
||||
COPY --from=build /app/apps/server/dist/ apps/server/dist/
|
||||
|
||||
EXPOSE 3000
|
||||
EXPOSE 3001
|
||||
|
||||
CMD ["node", "apps/server/dist/app.js"]
|
||||
|
||||
Reference in New Issue
Block a user