我正在使用此docker-compose来提供来自nginx的静态内容。
我正在尝试覆盖/usr/share/nginx/html
上的nginx index.html。
要实现我正在使用命名卷,请在服务content
中在文件夹/build
中生成此静态内容,并将其传递到我们的命名卷static-content
。
在服务reverse-proxy
中,我使用相同的命名卷static-content
并指向/usr/share/nginx/html
,以便覆盖index.html。
我已经确认/build
文件夹中包含文件,但是由于某种原因什么也没发生,因此创建了命名卷,但是nginx文件夹仍然包含默认的index.html,并且没有其他静态文件在/build
内部。
你能帮我吗?
content:
image: "${DOCKER_REGISTRY}/content"
volumes:
- static-content:/build
build:
context: .
depends_on:
- reverse-proxy
nginx:
image: "${DOCKER_REGISTRY}/nginx"
build:
context: .
volumes:
- static-content:/usr/share/nginx/html
ports:
- target: 80
published: 80
protocol: tcp
mode: host
- target: 443
protocol: tcp
mode: host
volumes:
static-content: