Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit a97b589

Browse files
committed
Add version as a env var to the docker image
1 parent 56515c7 commit a97b589

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,16 @@ jobs:
6363
cd operator/
6464
go fmt ./...
6565
go vet ./...
66+
- name: Parse Tag
67+
id: parse-tag
68+
run: echo ::set-output name=version::${GITHUB_REF#refs/*/}
6669
- name: "Build'n Push Operator"
6770
uses: docker/build-push-action@v1
6871
with:
6972
username: ${{ secrets.DOCKER_USERNAME }}
7073
password: ${{ secrets.DOCKER_PASSWORD }}
7174
repository: scbexperimental/operator
75+
build_args: VERSION=`${{ steps.parse-tag.outputs.version }}
7276
tag_with_ref: true
7377
tag_with_sha: true
7478
path: ./operator/

operator/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ RUN go mod download
1313
COPY main.go main.go
1414
COPY apis/ apis/
1515
COPY controllers/ controllers/
16+
COPY internal/ internal/
1617
COPY utils/ utils/
1718

1819
# Build
@@ -21,6 +22,11 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager
2122
# Use distroless as minimal base image to package the manager binary
2223
# Refer to https://github.com/GoogleContainerTools/distroless for more details
2324
FROM gcr.io/distroless/static:nonroot
25+
26+
ARG VERSION=unkown
27+
ENV VERSION ENV ${BRANCH}
28+
ENV TELEMETRY_ENABLED "true"
29+
2430
WORKDIR /
2531
COPY --from=builder /workspace/manager .
2632
USER nonroot:nonroot

0 commit comments

Comments
 (0)