--base-url flag for Zola CLI doesn't work in Docker - Stack Overflow

I have the following Dockerfile and compose.yaml to build and serve my Zola website:# Stage 1: Build t

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=";
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
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. For example, in my base.html I have the following line of code:

<link rel="stylesheet" href="{{ get_url(path="base.css") }}">

When I inspect the contents of the build inside of the Docker container the href has the value "$BASE_URL/base.css" instead of "http://localhost:8000/base.css".

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, but would like to confirm I haven't made any mistakes before I create an issue for this.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744845460a4596808.html

相关推荐

  • --base-url flag for Zola CLI doesn&#39;t work in Docker - Stack Overflow

    I have the following Dockerfile and compose.yaml to build and serve my Zola website:# Stage 1: Build t

    2天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信