Skip to content
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

Switch to docker multiplatform images and update packages #219

Merged
merged 1 commit into from
Apr 19, 2022

Conversation

lucaslorentz
Copy link
Owner

Fix #218

@lucaslorentz lucaslorentz force-pushed the fix-docker-images-platform branch 11 times, most recently from adfd396 to 92e5f03 Compare February 15, 2021 20:23
@francislavoie
Copy link
Collaborator

francislavoie commented Feb 15, 2021

Maybe you could consider switching to the caddy:<version>-builder image variant now? https://hub.docker.com/_/caddy

It ships with xcaddy so you can use that instead, to build the images.

@lucaslorentz lucaslorentz force-pushed the fix-docker-images-platform branch 3 times, most recently from d38b20a to d8a4ff1 Compare February 15, 2021 21:07
@0uep
Copy link

0uep commented Feb 25, 2021

Hi @francislavoie

I was not aware about caddy:<version>-builder. For your information, this is the way I build my docker image including three plugins:

FROM golang

RUN set -eux \
    ; \
    mkdir -p \
        /config/caddy \
        /data/caddy \
        /etc/caddy \
        /etc/gatekeeper/auth/local \
        /usr/share/caddy \
    ; \
    GO111MODULE=on go get -u github.com/caddyserver/xcaddy/cmd/xcaddy \
    ; \
    xcaddy build --with github.com/greenpau/caddy-auth-portal \
                 --with github.com/greenpau/caddy-auth-jwt \
                 --with github.com/lucaslorentz/caddy-docker-proxy/plugin/v2 \
                 --output /usr/bin/caddy

# set up nsswitch.conf for Go's "netgo" implementation
# - https://github.com/docker-library/golang/blob/1eb096131592bcbc90aa3b97471811c798a93573/1.14/alpine3.12/Dockerfile#L9
RUN [ -e /etc/nsswitch.conf ] || echo 'hosts: files dns' > /etc/nsswitch.conf

# https://caddyserver.com/docs/conventions#file-locations
ENV XDG_CONFIG_HOME /config
ENV XDG_DATA_HOME   /data

VOLUME /config
VOLUME /data
VOLUME /etc/caddy
VOLUME /etc/gatekeeper/auth

# Let's Encrypt TLS challenge
EXPOSE 80

# Official static web site
EXPOSE 443

# /metrics endpoint for Prometheus
EXPOSE 2019

WORKDIR /srv

ENV TZ "UTC0"
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]

@lucaslorentz
Copy link
Owner Author

lucaslorentz commented Feb 25, 2021

@0uep

CDP is executed using a different CLI command.

Your last line should be something like:

CMD ["caddy", "docker-proxy"]

@0uep
Copy link

0uep commented Feb 26, 2021

Thank you very much @lucaslorentz
I will check that when I will be motivated to migrate Caddyfile -> docker label

@lucaslorentz lucaslorentz force-pushed the fix-docker-images-platform branch 4 times, most recently from 2cea9e6 to fd805f4 Compare April 15, 2022 19:03
@lucaslorentz lucaslorentz changed the title Fix docker images platform Switch to docker multiplatform images and update packages Apr 15, 2022
@lucaslorentz lucaslorentz force-pushed the fix-docker-images-platform branch 2 times, most recently from 60de702 to 01aa26f Compare April 17, 2022 09:07
@lucaslorentz lucaslorentz mentioned this pull request Apr 17, 2022
@lucaslorentz lucaslorentz force-pushed the fix-docker-images-platform branch 3 times, most recently from d1ca28e to 47d7287 Compare April 18, 2022 04:25
@lucaslorentz
Copy link
Owner Author

@francislavoie Tried to use caddy builder image, but it would increase too much the build time because each platform would need to download all golang modules.
I will stick with building all binaries directly in the build agent for now.

@lucaslorentz lucaslorentz merged commit 9d46d94 into master Apr 19, 2022
@lucaslorentz lucaslorentz deleted the fix-docker-images-platform branch April 19, 2022 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docker image tag and arch mismatch
3 participants