diff --git a/.dockerignore b/.dockerignore index 1865f29..af55e3c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -9,3 +9,4 @@ coverage.txt Dockerfile LICENSE test.sh +.git diff --git a/Dockerfile b/Dockerfile index 351e334..8e57d6b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,16 +7,17 @@ FROM ${BASE_IMAGE_BUILDER}:${GO_VERSION}-alpine${ALPINE_VERSION} AS builder ARG GOARCH=amd64 ARG GOARM ARG VERSION=0.2.4 -RUN apk --update add -q --progress git +ARG VCS_REF= WORKDIR /go/src/github.com/jesseduffield/lazydocker/ COPY ./ . 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.buildSource=Docker" FROM ${BASE_IMAGE}:${ALPINE_VERSION} ARG VERSION=0.2.4 +ARG VCS_REF= LABEL org.label-schema.schema-version="1.0.0-rc1" \ maintainer="jessedduffield@gmail.com" \ org.label-schema.vcs-ref=$VCS_REF \ diff --git a/README.md b/README.md index c651f8f..3ebf97e 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,8 @@ go get github.com/jesseduffield/lazydocker 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. +

1. Run it