-
Notifications
You must be signed in to change notification settings - Fork 80
Updated Dockerfile in preparation for public Docker image #826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,9 @@ | |
| /temporal | ||
| /temporal.exe | ||
|
|
||
| # Goreleaser output | ||
| /dist | ||
|
|
||
| # Used by IDE | ||
| /.idea | ||
| /.vscode | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,12 @@ | ||
| FROM golang:1.24-bookworm AS builder | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Copy everything | ||
| COPY . ./ | ||
|
|
||
| # Build | ||
| RUN go build ./cmd/temporal | ||
|
|
||
| # Use slim container for running | ||
| FROM debian:bookworm-slim | ||
| RUN set -x && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ | ||
| ca-certificates && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
Comment on lines
-13
to
-15
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you confirm that this container has the alpine equivalent of
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. |
||
|
|
||
| # Copy binary | ||
| COPY --from=builder /app/temporal /app/temporal | ||
|
|
||
| # Set CLI as primary entrypoint | ||
| ENTRYPOINT ["/app/temporal"] | ||
| FROM --platform=$BUILDARCH scratch AS dist | ||
| COPY ./dist/nix_linux_amd64_v1/temporal /dist/amd64/temporal | ||
| COPY ./dist/nix_linux_arm64/temporal /dist/arm64/temporal | ||
|
|
||
| FROM alpine:3.22 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't this also need a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we don't test against this OS very well FWIW, though Go is self-contained and doesn't use libc/musl so it should be fine. But just curious why alpine instead of e.g.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was basing the image on our
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 Curious about the distroless one since it's fairly common these days (e.g. it's what Docker uses in their guide sample at https://docs.docker.com/guides/golang/build-images/#multi-stage-builds). But Alpine is fine too. Not a blocker.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking of recommending distroless too here. Alpine is a bit nicer if you ever want a shell to inspect the image, we may want that if we add support for config files later. Agree it's not a blocker. |
||
| ARG TARGETARCH | ||
| RUN apk add --no-cache ca-certificates | ||
| COPY --from=dist /dist/$TARGETARCH/temporal /usr/local/bin/temporal | ||
| RUN adduser -u 1000 -D temporal | ||
| USER temporal | ||
|
|
||
| ENTRYPOINT ["temporal"] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So was looking at https://goreleaser.com/customization/docker/ and it seems they won't publish for you, is that correct? If so, it makes sense we don't want to rely on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not documented but it can in fact push to Dockerhub. But since it's undocumented I don't want to rely on it. The bigger reason is that it can't build a true multiplatform image, it needs to build them separately for each platform and then combine them with a manifest, and it can only do one tag at a time it seems (and we need two - the version and the
latest). It too is very poorly documented, and also we're using Goreleaser v1 which they don't publish docs for anymore (I had to use Web Archive). Overall, it feels very not worth it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering why, with this conversation seemingly open-ended, the MR was merged.