简体   繁体   中英

Inline nginx conf in composer.yml file: possible?

I want to setup a reverse proxy with authentication for my webapp, here's my composer file:

 version: '3'
 services:
 nginx:
image: registry.azurecr.io/nginx:latest
container_name: nginx
volumes:
  - ./nginx/nginx.conf:/etc/nginx/nginx.conf
  - ./nginx/.htpasswd:/etc/nginx/.htpasswd
ports:
  - 80:80

myapp:
image: registry.azurecr.io/myapp:latest
container_name: myapp
expose:
  - 8080

As you can see I rely on two files to edit the nginx configuration. Problem is that I want to deploy this application to azure's app services but azure does not allow to specify external configurations (as far as I know).

So, is there a way to specify a couple of username/passwords in this same composer file?

For your requirement, you can use the persist storage for the web app or use the path mapping, then put the file in it. If you just want to put the file in the compose file, it seems it's impossible.

For persist storage, mount the persist volume to the path inside the container in the compose file, then enable the persist storage through setting the WEBSITES_ENABLE_APP_SERVICE_STORAGE as true in the app settings. For more details, see Use persistent storage in Docker Compose .

For path mapping, you need to create a storage account. Use the blob or the file share. See the document containerized app . Set the volume like this:

wordpress:
  image: wordpress:latest
  volumes:
  - <custom-id>:<path_in_container>

For more details about steps, see Serve content from Azure Storage in App Service on Linux .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM