I have the following Dockerfile
and compose.yaml
to build and serve my Zola website:
# Stage 1: Build the site with Zola
FROM ghcr.io/getzola/zola:v0.20.0 AS build
ARG BASE_URL="https://wha.sh"
COPY . /project
WORKDIR /project
RUN ["zola", "build", "--base-url", "$BASE_URL"]
# Stage 2: Serve the site with Static Web Server
FROM ghcr.io/static-web-server/static-web-server:2 AS server
WORKDIR /
COPY --from=build /project/public /public
name: wha.sh
services:
zola:
build:
context: .
target: server
args:
BASE_URL: "http://localhost:8000"
develop:
watch:
- path: .
action: rebuild
ports:
- "8000:80"
When I build with docker compose build --no-cache
I see in the log statements: => [zola build 4/4] RUN ["zola", "build", "--base-url", "http://localhost:8000"] 0.1s
.
This shows that the ARG
was read from compose.yaml
and used when executing zola build
.
However when I go to http://localhost:8000
and inspect anything that uses get_url
I see that the base url is the name of the ARG
, $BASE_URL
.
I’ve tried every combination of ARG
and ENV
in both theDockerfile
and compose.yaml
and am unable to have the --base-url
parameter work. I am starting to think it has to be an issue witht the Zola image rather than Docker.