Skip to content

Commit df7172c

Browse files
committed
feat: add build-info
1 parent 604b715 commit df7172c

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

.github/workflows/main.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ jobs:
5252
push: true
5353
platforms: linux/amd64,linux/arm64
5454
tags: wurstbrot/dsomm:${{ steps.get-version.outputs.version }},wurstbrot/dsomm:latest
55+
build-args: |
56+
COMMIT_HASH=${{ github.sha }}
57+
COMMIT_DATE=${{ github.event.head_commit.timestamp }}
58+
GIT_BRANCH=${{ github.ref_name }}
5559
# Commit all changed files back to the repository
5660
- uses: planetscale/[email protected]
5761
with:
@@ -84,4 +88,12 @@ jobs:
8488
heroku_app_name: "dsomm"
8589
heroku_email: [email protected]
8690
branch: ${{ env.HEROKU_BRANCH }}
87-
usedocker: true
91+
usedocker: true
92+
docker_build_args: |
93+
COMMIT_HASH
94+
COMMIT_DATE
95+
GIT_BRANCH
96+
env:
97+
COMMIT_HASH: ${{ github.sha }}
98+
COMMIT_DATE: ${{ github.event.head_commit.timestamp }}
99+
GIT_BRANCH: ${{ github.ref_name }}

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
FROM node:24.7.0-alpine3.22 AS build
22

3+
ARG COMMIT_HASH
4+
ARG COMMIT_DATE
5+
ARG GIT_BRANCH
6+
37
WORKDIR /usr/src/app
48
COPY package.json package-lock.json ./
59

@@ -9,6 +13,11 @@ RUN apk add --upgrade python3 build-base py3-setuptools py3-pip \
913
COPY . .
1014
RUN npm run build --configuration=production
1115

16+
RUN mkdir -p /usr/src/app/dist/dsomm/assets && \
17+
echo "commit: \"${COMMIT_HASH:-unknown}\"" > /usr/src/app/dist/dsomm/assets/build-info.yaml && \
18+
echo "commit_date: \"${COMMIT_DATE:-unknown}\"" >> /usr/src/app/dist/dsomm/assets/build-info.yaml && \
19+
echo "branch: \"${GIT_BRANCH:-unknown}\"" >> /usr/src/app/dist/dsomm/assets/build-info.yaml
20+
1221

1322
FROM wurstbrot/dsomm-yaml-generation:1.17.0 AS yaml
1423

0 commit comments

Comments
 (0)