fix: pass git commit hash as Docker build arg so footer shows correctly
All checks were successful
Deploy to VPS / deploy (push) Successful in 35s
All checks were successful
Deploy to VPS / deploy (push) Successful in 35s
git is not available inside the node:20-alpine Docker image, so git rev-parse in next.config.ts falls back to 'dev'. Now the commit hash is passed as a COMMIT_HASH build arg from the host where git is available, ensuring the footer displays the real commit hash. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -17,6 +17,7 @@ jobs:
|
||||
- name: Build and deploy
|
||||
run: |
|
||||
cd /home/remmer/StageAI
|
||||
export COMMIT_HASH=$(git rev-parse --short HEAD)
|
||||
docker compose build app
|
||||
docker compose up -d app
|
||||
echo "Deployed commit: $(git rev-parse --short HEAD)"
|
||||
echo "Deployed commit: $COMMIT_HASH"
|
||||
|
||||
@@ -7,6 +7,8 @@ RUN npm ci
|
||||
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
ARG COMMIT_HASH=dev
|
||||
ENV NEXT_PUBLIC_BUILD_HASH=$COMMIT_HASH
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
@@ -38,8 +38,9 @@ git reset --hard "origin/$BRANCH"
|
||||
echo "Updated to: $(git log --oneline -1)"
|
||||
|
||||
# Rebuild containers
|
||||
export COMMIT_HASH=$(git rev-parse --short HEAD)
|
||||
echo ""
|
||||
echo "Rebuilding containers..."
|
||||
echo "Rebuilding containers (commit: $COMMIT_HASH)..."
|
||||
docker compose -p "$PROJECT_NAME" build --no-cache app
|
||||
|
||||
if [[ "$BUILD_ONLY" == true ]]; then
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
services:
|
||||
app:
|
||||
build: .
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
COMMIT_HASH: ${COMMIT_HASH:-dev}
|
||||
ports:
|
||||
- "3002:3000"
|
||||
environment:
|
||||
|
||||
Reference in New Issue
Block a user