mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-21 23:01:03 +00:00
Git commit reference mechanism changed
- Git commit is passed as a build argument as explained in README.md - `.git` directory is ignored by Docker for a quicker build and smaller context - the build arg VCS_REF is used both to tag the image and the Go program
This commit is contained in:
parent
330131b6ca
commit
fd70aaaf05
3 changed files with 6 additions and 2 deletions
|
|
@ -9,3 +9,4 @@ coverage.txt
|
||||||
Dockerfile
|
Dockerfile
|
||||||
LICENSE
|
LICENSE
|
||||||
test.sh
|
test.sh
|
||||||
|
.git
|
||||||
|
|
|
||||||
|
|
@ -7,16 +7,17 @@ FROM ${BASE_IMAGE_BUILDER}:${GO_VERSION}-alpine${ALPINE_VERSION} AS builder
|
||||||
ARG GOARCH=amd64
|
ARG GOARCH=amd64
|
||||||
ARG GOARM
|
ARG GOARM
|
||||||
ARG VERSION=0.2.4
|
ARG VERSION=0.2.4
|
||||||
RUN apk --update add -q --progress git
|
ARG VCS_REF=
|
||||||
WORKDIR /go/src/github.com/jesseduffield/lazydocker/
|
WORKDIR /go/src/github.com/jesseduffield/lazydocker/
|
||||||
COPY ./ .
|
COPY ./ .
|
||||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${GOARCH} GOARM=${GOARM} go build -a -installsuffix cgo -ldflags="-s -w \
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${GOARCH} GOARM=${GOARM} go build -a -installsuffix cgo -ldflags="-s -w \
|
||||||
-X main.commit=$(git rev-parse HEAD) \
|
-X main.commit=${VCS_REF} \
|
||||||
-X main.version=${VERSION} \
|
-X main.version=${VERSION} \
|
||||||
-X main.buildSource=Docker"
|
-X main.buildSource=Docker"
|
||||||
|
|
||||||
FROM ${BASE_IMAGE}:${ALPINE_VERSION}
|
FROM ${BASE_IMAGE}:${ALPINE_VERSION}
|
||||||
ARG VERSION=0.2.4
|
ARG VERSION=0.2.4
|
||||||
|
ARG VCS_REF=
|
||||||
LABEL org.label-schema.schema-version="1.0.0-rc1" \
|
LABEL org.label-schema.schema-version="1.0.0-rc1" \
|
||||||
maintainer="jessedduffield@gmail.com" \
|
maintainer="jessedduffield@gmail.com" \
|
||||||
org.label-schema.vcs-ref=$VCS_REF \
|
org.label-schema.vcs-ref=$VCS_REF \
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,8 @@ go get github.com/jesseduffield/lazydocker
|
||||||
https://github.com/jesseduffield/lazydocker.git
|
https://github.com/jesseduffield/lazydocker.git
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can also add `--build-arg VCS_REF=$(git rev-parse HEAD)` so that the go build and the container contain the commit used.
|
||||||
|
|
||||||
</p></details>
|
</p></details>
|
||||||
1. Run it
|
1. Run it
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue