WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 62c5ef7

Browse files
committed
fix: set version info for Docker image
1 parent 1aaa8b6 commit 62c5ef7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.github/workflows/docker-image.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ jobs:
2020
- name: Check out the repo
2121
uses: actions/checkout@v3
2222

23+
- name: Save version info
24+
run: |
25+
git describe --tags > VERSION
26+
2327
- name: Log in to Docker Hub
2428
uses: docker/login-action@v2
2529
with:

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ FROM node:16 as builder
22

33
WORKDIR /build
44
COPY ./web .
5+
COPY ./VERSION .
56
RUN npm install
6-
RUN npm run build
7+
RUN REACT_APP_VERSION=$(cat VERSION) npm run build
78

89
FROM golang AS builder2
910

@@ -15,7 +16,7 @@ WORKDIR /build
1516
COPY . .
1617
COPY --from=builder /build/build ./web/build
1718
RUN go mod download
18-
RUN go build -ldflags "-s -w -extldflags '-static'" -o message-pusher
19+
RUN go build -ldflags "-s -w -X 'gin-template/common.Version=$(cat VERSION)' -extldflags '-static'" -o message-pusher
1920

2021
FROM alpine
2122

0 commit comments

Comments
 (0)