-
Notifications
You must be signed in to change notification settings - Fork 194
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
Use Chainguard images for build and runtime #2102
Closed
Closed
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
# syntax=docker/dockerfile:latest | ||
## build ergo binary | ||
FROM docker.io/golang:1.21-alpine AS build-env | ||
|
||
RUN apk upgrade -U --force-refresh --no-cache && apk add --no-cache --purge --clean-protected -l -u make git | ||
FROM cgr.dev/chainguard/go:latest AS build-env | ||
|
||
# copy ergo source | ||
WORKDIR /go/src/github.com/ergochat/ergo | ||
|
@@ -15,34 +14,33 @@ RUN sed -i 's/^\(\s*\)\"127.0.0.1:6667\":.*$/\1":6667":/' /go/src/github.com/erg | |
# compile | ||
RUN make install | ||
|
||
## tmp container for collecting files | ||
FROM scratch AS tmp | ||
|
||
# collect all files | ||
COPY --from=build-env /root/go/bin/ergo \ | ||
/go/src/github.com/ergochat/ergo/default.yaml \ | ||
/go/src/github.com/ergochat/ergo/distrib/docker/run.sh \ | ||
/ircd-bin/ | ||
COPY --from=build-env /go/src/github.com/ergochat/ergo/languages /ircd-bin/languages/ | ||
COPY --from=build-env /go/src/github.com/ergochat/ergo/ergo.motd /ircd/ergo.motd | ||
|
||
## build ergo container | ||
FROM docker.io/alpine:3.13 | ||
FROM cgr.dev/chainguard/busybox:latest-glibc AS runtime | ||
|
||
# metadata | ||
LABEL maintainer="Daniel Oaks <[email protected]>,Daniel Thamdrup <[email protected]>" \ | ||
LABEL maintainer="Daniel Oaks <[email protected]>,Daniel Thamdrup <[email protected]>" \ | ||
description="Ergo is a modern, experimental IRC server written in Go" | ||
|
||
# standard ports listened on | ||
EXPOSE 6667/tcp 6697/tcp | ||
|
||
# ergo itself | ||
COPY --from=build-env /go/bin/ergo \ | ||
/go/src/github.com/ergochat/ergo/default.yaml \ | ||
/go/src/github.com/ergochat/ergo/distrib/docker/run.sh \ | ||
/ircd-bin/ | ||
COPY --from=build-env /go/src/github.com/ergochat/ergo/languages /ircd-bin/languages/ | ||
COPY --from=tmp --chown=nonroot:nonroot / / | ||
|
||
# running volume holding config file, db, certs | ||
VOLUME /ircd | ||
WORKDIR /ircd | ||
|
||
# default motd | ||
COPY --from=build-env /go/src/github.com/ergochat/ergo/ergo.motd /ircd/ergo.motd | ||
|
||
# launch | ||
ENTRYPOINT ["/ircd-bin/run.sh"] | ||
|
||
# # uncomment to debug | ||
# RUN apk add --no-cache bash | ||
# RUN apk add --no-cache vim | ||
# CMD /bin/bash |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Just curious, any reason to prefer glibc over musl here? It sounds like musl is the default: https://edu.chainguard.dev/chainguard/chainguard-images/reference/busybox/#image-variants
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.
Potential workaround for your issue with faccessat2(2) as I figured maybe it was an alpine/musl related issue and the default latest tag uses alpine and musl as a base instead of wolfi and glibc.
However if you can still reproduce it with this PR then it would seem it's not a very good workaround :)
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.
Oh, my mistake --- I reproduced the issue using Alpine, not this branch. I'm no longer very concerned about the issue, since Docker 20.10 should have an effective workaround (discussion on #2103)