Skip to content

Commit 2914f3e

Browse files
committed
generate version.ts in docker build
1 parent e363c47 commit 2914f3e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.github/workflows/docker.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,5 @@ jobs:
5454
labels: ${{ steps.meta.outputs.labels }}
5555
cache-from: type=gha
5656
cache-to: type=gha,mode=max
57+
build-args: |
58+
VERSION=${{ github.ref_type == 'tag' && github.ref_name || format('main-{0}', github.sha) }}

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
# Multi-stage Dockerfile for GPTdash
2+
ARG VERSION=unknown
3+
24
# Stage 1: Build frontend
35
FROM node:24-alpine AS frontend
6+
ARG VERSION
47
WORKDIR /app/frontend
58

69
COPY frontend/package*.json ./
710
RUN npm ci
811

912
COPY frontend/ ./
13+
14+
# Generate version.ts file like the Makefile does
15+
RUN echo "export const VERSION = \"$VERSION\";" > src/version.ts
16+
1017
RUN npm run build
1118

1219
# Stage 2: Build Go backend with embedded frontend

0 commit comments

Comments
 (0)