Skip to content

Commit 208167a

Browse files
committed
Switch back to Alpine, improve commit_sha and branch vars
1 parent 40be746 commit 208167a

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

.github/workflows/pull-request.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ jobs:
5252
}
5353
}
5454
55+
- name: Set the commit_sha and branch
56+
shell: bash
57+
run: |
58+
echo "commit_sha=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
59+
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> "$GITHUB_ENV"
60+
5561
- name: Set up QEMU
5662
uses: docker/setup-qemu-action@v3
5763

.github/workflows/push.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ jobs:
5252
}
5353
}
5454
55+
- name: Set the commit_sha and branch
56+
shell: bash
57+
run: |
58+
echo "commit_sha=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
59+
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> "$GITHUB_ENV"
60+
5561
- name: Set up QEMU
5662
uses: docker/setup-qemu-action@v3
5763

.github/workflows/tagged-release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ jobs:
2020
}
2121
}
2222
23+
- name: Set the commit_sha and branch
24+
shell: bash
25+
run: |
26+
echo "commit_sha=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
27+
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> "$GITHUB_ENV"
28+
2329
- name: Set up QEMU
2430
uses: docker/setup-qemu-action@v3
2531

Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ ARG DRONE_COMMIT
1515
# Build application
1616
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -o /go/bin/httptest \
1717
-ldflags "-extldflags \"-static\" \
18-
-X main.BuildBranch=${DRONE_BRANCH} \
19-
-X main.BuildCommit=${DRONE_COMMIT:0:8} \
18+
-X main.BuildBranch=${{ env.branch }} \
19+
-X main.BuildCommit=${{ env.commit_sha }} \
2020
-X main.BuildTime=$(date -Iseconds)"
2121

22-
# Distroless; smaller than Alpine, has SSL included, works for multi-arch
23-
FROM gcr.io/distroless/static-debian12
22+
# We can't use distroless because some teams need to add a bearer token to
23+
# authenticate when the tests are run
24+
FROM alpine
25+
26+
# Install dependencies
27+
RUN apk add --no-cache ca-certificates
2428

2529
# Copy binary from build container
2630
COPY --from=build /go/bin/httptest /bin/httptest

0 commit comments

Comments
 (0)