我有一个生产环境的配置:
docker-compose-prod.yml
version: '3.3'
services:
nginx:
build:
context: nginx
dockerfile: Dockerfile
args:
LANDING_PAGE_DOMAIN: ${LANDING_PAGE_DOMAIN}
container_name: nginx
networks:
- app-network
Dockerfile
FROM nginx:alpine
COPY nginx.conf /etc/nginx/nginx.conf
COPY production/* /etc/nginx/conf.d/
ARG LANDING_PAGE_DOMAIN
RUN sed -i s/{LANDING_PAGE_DOMAIN}/${LANDING_PAGE_DOMAIN}/g /etc/nginx/conf.d/landing.conf
EXPOSE 80 443
当我尝试构建它时,我收到了以下警告:
docker-compose -f docker-compose.production.yml build --build-arg LANDING_PAGE_DOMAIN="test.com" nginx
警告:LANDING_PAGE_DOMAIN变量未设置。 默认为空字符串。
我犯了什么错误?
ARG LANDING_PAGE_DOMAIN $LANDING_PAGE_DOMAIN
或在开始构建之前导出它。 - LinPy