Skip to content

Commit 4246b64

Browse files
committed
docker alpine->google-distroless
1 parent fbc8ad9 commit 4246b64

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,48 @@ jobs:
1010
name: Test
1111
strategy:
1212
matrix:
13-
go-version: [1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x, 1.18.x, 1.19.x]
13+
go-version: [1.16.x, 1.17.x, 1.18.x, 1.19.x]
1414
platform: [ubuntu-latest, macos-latest, windows-latest]
1515
runs-on: ${{ matrix.platform }}
1616
steps:
1717
- name: Install Go
18-
uses: actions/setup-go@v1
18+
uses: actions/setup-go@v2
1919
with:
2020
go-version: ${{ matrix.go-version }}
2121
- name: Checkout code
22-
uses: actions/checkout@v3.1.0
22+
uses: actions/checkout@v3
2323
- name: Build
2424
run: go build -v .
2525
- name: Test
2626
run: go test -v ./...
27-
env:
28-
GODEBUG: x509ignoreCN=0
2927
# ================
30-
# RELEASE JOB
28+
# RELEASE JOBS
3129
# runs after a success test
3230
# only runs on push "v*" tag
3331
# ================
34-
release:
35-
name: Release
32+
release_binaries:
33+
name: Release Binaries
3634
needs: test
3735
if: startsWith(github.ref, 'refs/tags/v')
3836
runs-on: ubuntu-latest
3937
steps:
4038
- name: Check out code
41-
uses: actions/checkout@v3.1.0
39+
uses: actions/checkout@v3
4240
- name: goreleaser
4341
if: success()
4442
uses: docker://goreleaser/goreleaser:latest
4543
env:
4644
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4745
with:
4846
args: release --config .github/goreleaser.yml
47+
release_docker:
48+
name: Release Docker Images
49+
needs: test
50+
if: startsWith(github.ref, 'refs/tags/v')
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Check out code
54+
uses: actions/checkout@v3
4955
- name: Set up QEMU
5056
uses: docker/setup-qemu-action@v1
5157
- name: Set up Docker Buildx
@@ -58,21 +64,16 @@ jobs:
5864
password: ${{ secrets.DOCKERHUB_TOKEN }}
5965
- name: Docker meta
6066
id: docker_meta
61-
uses: crazy-max/ghaction-docker-meta@v1
67+
uses: docker/metadata-action@v4
6268
with:
6369
images: jpillora/chisel
6470
tag-latest: true
65-
# Outputs:
66-
# jpillora/chisel:1.2.3
67-
# jpillora/chisel:1.2
68-
# jpillora/chisel:1
69-
# jpillora/chisel:latest
70-
tag-semver: |
71-
{{version}}
72-
{{major}}.{{minor}}
73-
{{major}}
71+
tags: |
72+
type=semver,pattern={{version}}
73+
type=semver,pattern={{major}}.{{minor}}
74+
type=semver,pattern={{major}}
7475
- name: Build and push
75-
uses: docker/build-push-action@v2
76+
uses: docker/build-push-action@v3
7677
with:
7778
context: .
7879
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/386,linux/arm/v7,linux/arm/v6

Dockerfile

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
# build stage
2-
FROM golang:alpine AS build-env
2+
FROM golang:1.19 as build
33
LABEL maintainer="[email protected]"
4-
RUN apk update
5-
RUN apk add git
64
ENV CGO_ENABLED 0
75
ADD . /src
86
WORKDIR /src
7+
RUN go mod download
98
RUN go build \
109
-ldflags "-X github.com/jpillora/chisel/share.BuildVersion=$(git describe --abbrev=0 --tags)" \
1110
-o chisel
12-
# container stage
13-
FROM alpine
14-
RUN apk update && apk add --no-cache ca-certificates
11+
# run stage
12+
FROM gcr.io/distroless/static-debian11
1513
WORKDIR /app
16-
COPY --from=build-env /src/chisel /app/chisel
17-
ENTRYPOINT ["/app/chisel"]
14+
CMD ["/app"]
15+
COPY --from=build /src/chisel /app/chisel
16+
ENTRYPOINT ["/app/chisel"]

0 commit comments

Comments
 (0)