-
Notifications
You must be signed in to change notification settings - Fork 165
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
Add Dockerfile to be called from docker build #176
Conversation
FWIW we probably plan to move the official docker image to use
|
@francislavoie @hairyhenderson Create a Dockerfile in the root of https://github.com/caddyserver/caddy-docker, which accepts the plugins and caddy version as args. Like this That way it would be even simpler to build a custom image, just one command:
|
I think this is a good resolution for #175. |
On the topic of moving to As for a Personally I prefer just using a straight |
@hairyhenderson Dockerfile is simple, but it is undeniably one more step for users, while they could just point to a remote Dockerfile. I will add the Dockerfile to this repo. If Caddy officially adopts this way as well in the future I will be happy to point users to official Caddy instructions. |
IMO it's the same number of steps: either users must commit a build script to their source control, or they must commit a Personally I've been teaching people to write Dockerfiles instead of shell scripts due to the improvements in portability and reproducibility, but there's nothing wrong with providing alternate methods. I'll consider the |
@hairyhenderson I did versioning as just another argument and it still uses caddy:builder.
|
I would suggest maintaining only one Dockerfile like that. |
Hmm! Thanks @lucaslorentz - I hadn't actually read the Dockerfile that closely (still on vacation so not paying enough attention 😅). It is actually pretty straightforward. I think the only blocker for supporting it in the caddy-docker repo is that repo is focused on the official image, and official images have some restrictions, one of which is that build-args are not allowed (due to requirements on reproducibility). I've opened caddyserver/caddy-docker#108 to continue that discussion, though. |
I think this can now be updated to use |
RUN caddy-builder \ | ||
github.com/lucaslorentz/caddy-docker-proxy/plugin/v2 \ | ||
${PLUGINS} |
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.
RUN caddy-builder \ | |
github.com/lucaslorentz/caddy-docker-proxy/plugin/v2 \ | |
${PLUGINS} | |
RUN xcaddy build \ | |
--with github.com/lucaslorentz/caddy-docker-proxy/plugin/v2 \ | |
${PLUGINS} |
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.
The ${PLUGINS}
part might need to be revised to run a shell command to prefix each one with --with
to be compatible with xcaddy
.
@@ -1,19 +1,13 @@ | |||
FROM alpine:3.11 as alpine | |||
RUN apk add -U --no-cache ca-certificates | |||
ARG CADDY_VERSION=2.1.1 |
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.
ARG CADDY_VERSION=2.1.1 | |
ARG CADDY_VERSION=2.4.0 |
COPY --from=builder /usr/bin/caddy /usr/bin/caddy |
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'll still be necessary to override the CMD
COPY --from=builder /usr/bin/caddy /usr/bin/caddy | |
COPY --from=builder /usr/bin/caddy /usr/bin/caddy | |
CMD ["caddy", "docker-proxy"] |
Thanks @francislavoie |
How to use it before merging this PR:
After merging this PR, we can drop the
#builder
(branch).@flaviostutz
What do you think about this as as fix for #175?
PS: I still need to udpate the README file.