Merge pull request #654 from ChibangLW/main
Add version info to binary in Docker container
This commit is contained in:
commit
6da4396faa
4 changed files with 12 additions and 3 deletions
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
|
@ -89,6 +89,8 @@ jobs:
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache-new
|
cache-to: type=local,dest=/tmp/.buildx-cache-new
|
||||||
|
build-args: |
|
||||||
|
VERSION=${{ steps.meta.outputs.version }}
|
||||||
- name: Prepare cache for next build
|
- name: Prepare cache for next build
|
||||||
run: |
|
run: |
|
||||||
rm -rf /tmp/.buildx-cache
|
rm -rf /tmp/.buildx-cache
|
||||||
|
@ -153,6 +155,8 @@ jobs:
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache-debug
|
cache-from: type=local,src=/tmp/.buildx-cache-debug
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache-debug-new
|
cache-to: type=local,dest=/tmp/.buildx-cache-debug-new
|
||||||
|
build-args: |
|
||||||
|
VERSION=${{ steps.meta-debug.outputs.version }}
|
||||||
- name: Prepare cache for next build
|
- name: Prepare cache for next build
|
||||||
run: |
|
run: |
|
||||||
rm -rf /tmp/.buildx-cache-debug
|
rm -rf /tmp/.buildx-cache-debug
|
||||||
|
@ -217,6 +221,8 @@ jobs:
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache-alpine
|
cache-from: type=local,src=/tmp/.buildx-cache-alpine
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache-alpine-new
|
cache-to: type=local,dest=/tmp/.buildx-cache-alpine-new
|
||||||
|
build-args: |
|
||||||
|
VERSION=${{ steps.meta-alpine.outputs.version }}
|
||||||
- name: Prepare cache for next build
|
- name: Prepare cache for next build
|
||||||
run: |
|
run: |
|
||||||
rm -rf /tmp/.buildx-cache-alpine
|
rm -rf /tmp/.buildx-cache-alpine
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# Builder image
|
# Builder image
|
||||||
FROM docker.io/golang:1.18.0-bullseye AS build
|
FROM docker.io/golang:1.18.0-bullseye AS build
|
||||||
|
ARG VERSION=dev
|
||||||
ENV GOPATH /go
|
ENV GOPATH /go
|
||||||
WORKDIR /go/src/headscale
|
WORKDIR /go/src/headscale
|
||||||
|
|
||||||
|
@ -8,7 +9,7 @@ RUN go mod download
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux go install -a ./cmd/headscale
|
RUN CGO_ENABLED=0 GOOS=linux go install -ldflags="-s -w -X github.com/juanfont/headscale/cmd/headscale/cli.Version=$VERSION" -a ./cmd/headscale
|
||||||
RUN strip /go/bin/headscale
|
RUN strip /go/bin/headscale
|
||||||
RUN test -e /go/bin/headscale
|
RUN test -e /go/bin/headscale
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# Builder image
|
# Builder image
|
||||||
FROM docker.io/golang:1.18.0-alpine AS build
|
FROM docker.io/golang:1.18.0-alpine AS build
|
||||||
|
ARG VERSION=dev
|
||||||
ENV GOPATH /go
|
ENV GOPATH /go
|
||||||
WORKDIR /go/src/headscale
|
WORKDIR /go/src/headscale
|
||||||
|
|
||||||
|
@ -9,7 +10,7 @@ RUN go mod download
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux go install -a ./cmd/headscale
|
RUN CGO_ENABLED=0 GOOS=linux go install -ldflags="-s -w -X github.com/juanfont/headscale/cmd/headscale/cli.Version=$VERSION" -a ./cmd/headscale
|
||||||
RUN strip /go/bin/headscale
|
RUN strip /go/bin/headscale
|
||||||
RUN test -e /go/bin/headscale
|
RUN test -e /go/bin/headscale
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# Builder image
|
# Builder image
|
||||||
FROM docker.io/golang:1.18.0-bullseye AS build
|
FROM docker.io/golang:1.18.0-bullseye AS build
|
||||||
|
ARG VERSION=dev
|
||||||
ENV GOPATH /go
|
ENV GOPATH /go
|
||||||
WORKDIR /go/src/headscale
|
WORKDIR /go/src/headscale
|
||||||
|
|
||||||
|
@ -8,7 +9,7 @@ RUN go mod download
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux go install -a ./cmd/headscale
|
RUN CGO_ENABLED=0 GOOS=linux go install -ldflags="-s -w -X github.com/juanfont/headscale/cmd/headscale/cli.Version=$VERSION" -a ./cmd/headscale
|
||||||
RUN test -e /go/bin/headscale
|
RUN test -e /go/bin/headscale
|
||||||
|
|
||||||
# Debug image
|
# Debug image
|
||||||
|
|
Loading…
Reference in a new issue