From e3b141389bdfa101230fc83adbfd7eb24f43376f Mon Sep 17 00:00:00 2001 From: x70b1 <10016267+x70b1@users.noreply.github.com> Date: Thu, 13 Oct 2022 00:13:45 +0200 Subject: [PATCH 1/4] update golang, replace CMD --- Dockerfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5f38b95d..b9828c18 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,18 @@ # syntax = docker/dockerfile:1.3 -FROM golang:1.18 +# Golang +FROM golang:1.19 as build WORKDIR /go/src/github.com/mccutchen/go-httpbin COPY . . + RUN --mount=type=cache,id=gobuild,target=/root/.cache/go-build \ make build buildtests +# distroless FROM gcr.io/distroless/base -COPY --from=0 /go/src/github.com/mccutchen/go-httpbin/dist/go-httpbin* /bin/ + +COPY --from=build /go/src/github.com/mccutchen/go-httpbin/dist/go-httpbin* /bin/ + EXPOSE 8080 -CMD ["/bin/go-httpbin"] +ENTRYPOINT ["/bin/go-httpbin"] From 1dd14547b0ff72eb13768e995bfb26462ff62758 Mon Sep 17 00:00:00 2001 From: x70b1 Date: Thu, 13 Oct 2022 13:22:37 +0200 Subject: [PATCH 2/4] fix dockerfile style --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index b9828c18..38a382b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ # syntax = docker/dockerfile:1.3 -# Golang -FROM golang:1.19 as build +FROM golang:1.19 AS build WORKDIR /go/src/github.com/mccutchen/go-httpbin @@ -9,10 +8,10 @@ COPY . . RUN --mount=type=cache,id=gobuild,target=/root/.cache/go-build \ make build buildtests -# distroless FROM gcr.io/distroless/base COPY --from=build /go/src/github.com/mccutchen/go-httpbin/dist/go-httpbin* /bin/ EXPOSE 8080 + ENTRYPOINT ["/bin/go-httpbin"] From 0adbb0c262b0a36c5d66bf5c949f3c6526d7d5b1 Mon Sep 17 00:00:00 2001 From: x70b1 Date: Thu, 13 Oct 2022 13:23:17 +0200 Subject: [PATCH 3/4] update GitHub Actions to golang 1.19 --- .github/workflows/lint.yaml | 2 +- .github/workflows/test.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index b1e57069..47284414 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: '1.18' + go-version: '1.19' - uses: golangci/golangci-lint-action@v3.1.0 with: version: v1.45.2 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a528f373..895987e2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -19,7 +19,7 @@ jobs: steps: - uses: actions/setup-go@v2 with: - go-version: '1.18' + go-version: '1.19' - uses: actions/checkout@v2 @@ -38,8 +38,8 @@ jobs: strategy: matrix: go_version: + - '1.18' - '1.17' - - '1.16' steps: - uses: actions/setup-go@v2 From 3430fe8c05843e4a053b0ad624ec72018504f635 Mon Sep 17 00:00:00 2001 From: x70b1 Date: Thu, 13 Oct 2022 16:00:01 +0200 Subject: [PATCH 4/4] reset Dockerfile back to CMD --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 38a382b1..d90249f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,5 +13,4 @@ FROM gcr.io/distroless/base COPY --from=build /go/src/github.com/mccutchen/go-httpbin/dist/go-httpbin* /bin/ EXPOSE 8080 - -ENTRYPOINT ["/bin/go-httpbin"] +CMD ["/bin/go-httpbin"]