Skip to content

Commit

Permalink
DRY dockerfile by putting base image SHA into an argument (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
keynmol authored Mar 19, 2024
1 parent 4ea6ec8 commit 9f0febb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,17 @@
# Manifests:
# <other stuff to ignore>
# And use this digest in FROM
FROM golang:1.22.1@sha256:0b55ab82ac2a54a6f8f85ec8b943b9e470c39e32c109b766bbc1b801f3fa8d3b as builder

ARG base_sha=0b55ab82ac2a54a6f8f85ec8b943b9e470c39e32c109b766bbc1b801f3fa8d3b

FROM golang:1.22.1@sha256:${base_sha} as builder

COPY . /sources
WORKDIR /sources
RUN go build -o scip-go ./cmd/scip-go

# Keep in sync with builder image
FROM golang:1.22.1@sha256:0b55ab82ac2a54a6f8f85ec8b943b9e470c39e32c109b766bbc1b801f3fa8d3b as final
FROM golang:1.22.1@sha256:${base_sha} as final

COPY --from=builder /sources/scip-go /usr/bin/
CMD ["scip-go"]

0 comments on commit 9f0febb

Please sign in to comment.