1. Caddy version (caddy version
): v2.4.6 h1:HGkGICFGvyrodcqOOclHKfvJC0qTU7vny/7FhYp9hNw=
2. How I run Caddy: in a caddy-alpine docker container
a. System environment: Docker
b. Command:
docker run ...
c. Service/unit/compose file:
FROM caddy:alpine
ARG DOMAIN
COPY ./dist /usr/share/caddy
COPY Caddyfile /etc/caddy/Caddyfile
RUN sed -i "s/local.lan/${DOMAIN}/g" /etc/caddy/Caddyfile
d. My complete Caddyfile or JSON config:
local.lan {
handle_path /api* {
reverse_proxy g5api:3301
}
handle {
root * /usr/share/caddy
try_files {path} /index.html
file_server
}
}
3. The problem I’m having:
How to build the image without baking in the domain name on build time? I have not found anything useful yet, bc I have no idea how to formulate the search query.
4. Error messages and/or full log output:
The docker container is trying to start with my testing domain in production.
5. What I already tried:
I spent a few hours on this and considered it done, since I have not tested it properly. It worked on my testing setup, so I assumed everything worked as intended. The final domain in the caddyfile is replaced on container creation, not image build time.