fix: rename workflow to deploy, and parse git rev in the dockerfile
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
*.log
|
*.log
|
||||||
.git
|
|
||||||
.env
|
.env
|
||||||
.cache
|
.cache
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ jobs:
|
|||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
run: docker build --build-arg COMMIT_SHA=$(git rev-parse --short HEAD) -f apps/discord-bot/Dockerfile .
|
run: docker build -f apps/discord-bot/Dockerfile .
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
FROM node:22-alpine
|
FROM alpine AS git-sha
|
||||||
|
RUN apk add --no-cache git
|
||||||
|
COPY .git .git
|
||||||
|
RUN git rev-parse --short HEAD > /commit_sha
|
||||||
|
|
||||||
|
FROM node:22-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN corepack enable && corepack prepare pnpm@10.24.0 --activate
|
RUN corepack enable && corepack prepare pnpm@10.24.0 --activate
|
||||||
@@ -15,7 +19,6 @@ RUN pnpm --filter @lbf-bot/utils run build
|
|||||||
RUN pnpm --filter @lbf-bot/database run build
|
RUN pnpm --filter @lbf-bot/database run build
|
||||||
RUN pnpm --filter @lbf/discord-bot run build
|
RUN pnpm --filter @lbf/discord-bot run build
|
||||||
|
|
||||||
ARG COMMIT_SHA=dev
|
COPY --from=git-sha /commit_sha /commit_sha
|
||||||
ENV COMMIT_SHA=$COMMIT_SHA
|
|
||||||
|
|
||||||
CMD ["node", "apps/discord-bot/dist/index.js"]
|
CMD export COMMIT_SHA=$(cat /commit_sha) && exec node apps/discord-bot/dist/index.js
|
||||||
|
|||||||
Reference in New Issue
Block a user