Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/build_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ jobs:
type=ref,event=tag
type=sha,format=short,prefix=

# generate frontend build date in utc
- name: Generate frontend build date
id: frontend_build_meta
run: echo "build_date=$(date -u +'%Y/%m/%d UTC')" >> "$GITHUB_OUTPUT"

# build and push frontend docker image with version argument
- name: Build Frontend Docker image
uses: docker/build-push-action@v5
Expand All @@ -126,6 +131,7 @@ jobs:
platforms: linux/amd64
build-args: |
VERSION=${{ github.ref_type == 'tag' && github.ref_name || '' }}
BUILD_DATE=${{ steps.frontend_build_meta.outputs.build_date }}

update_helm_values:
runs-on: ubuntu-24.04
Expand Down
9 changes: 6 additions & 3 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ ENV NODE_ENV=production
# accepts version argument to override package.json version
ARG VERSION=""

# accepts build date argument to set package.json build metadata
ARG BUILD_DATE=""

COPY --from=deps /app/node_modules ./node_modules
COPY . .

# update package.json version if VERSION arg is provided
RUN if [ -n "$VERSION" ]; then \
node -e "const pkg = require('./package.json'); pkg.version = '$VERSION'; require('fs').writeFileSync('./package.json', JSON.stringify(pkg, null, 2))"; \
# update package.json build metadata when build args are provided
RUN if [ -n "$VERSION" ] || [ -n "$BUILD_DATE" ]; then \
VERSION="$VERSION" BUILD_DATE="$BUILD_DATE" node -e "const fs = require('fs'); const pkg = require('./package.json'); const version = process.env.VERSION; const buildDate = process.env.BUILD_DATE; if (version) pkg.version = version; if (buildDate) pkg.buildDate = buildDate; fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2) + '\\n')"; \
fi

EXPOSE 3000
Expand Down
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "linux-do-credit",
"version": "1.0.0",
"buildDate": "2026-01-01T00:00:00Z",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
Expand Down
Loading