Azure App Service Docker + Mounted Storage

Hey all,

With Azure App Services supporting mounting of storage accounts, I managed to get this project working in Azure App Services as a Docker container, using a mounted storage account. There’s some manual setup involved and requires copying files, but it appears to be working fine. In the future there may be a more robust method to do this, but in the meantime…

  1. Create an Azure App Service, choosing the Container type, and use the strapi/strapi:latest as the image name. Once it is created, Stop the app service.
  2. Create an Azure Storage account, choosing Standard or Premium, just make sure it’s a StorageV2 type.
  3. In the newly created Storage Account, create a private container, name whatever you want.
  4. On the Azure App Service, go to Configuration → Path Mappings, select the Storage account from step 2, and the container name from step 3.
  5. Have your database setup (MongoDB, MySQL, Postgres, whatever)
  6. On your local machine with Docker installed, run the following (assuming Mac/Linux, make appropriate path changes for Windows)
    docker run -it -p 1337:1337 (pass all of your database parameters here as well) -v /tmp/app:/srv/app strapi/strapi:latest
  7. After it builds everything, it serves up the app on port 1337. You can go to localhost:1337 now to setup your admin user to verify your database connection is good. If database connections are failing, check your /tmp/app/config/database.js file
  8. Stop the container (Ctrl-C)
  9. Using azcopy or another method to transfer files to the Storage Account, copy your installed files to your Storage Account container, example: azcopy copy '/tmp/app/*' 'https://yourstorageaccountname.blob.core.windows.net/containerNameFromStep4' --recursive
  10. Once that is complete, Start your app service. After a bit of time, it should load up the site and you should be good to go.
1 Like

Thank you for this!

Hello @asc-adean - thank you and well done with the small tutorial.

I have some questions regarding your solution:

  1. What did you fill in as Mount path in the Path mapping of the App Service? (see image below)

  2. How does your Container in the Storage Account look like after you upload the files?

  3. Please, can you share some images for some of the steps? (such as steps 4, 6, 9)

  4. Would the update regarding the read-only of Blob containers affect this setup?
    app-service-linux-docs/mounting_azure_blob.md at master · Azure/app-service-linux-docs · GitHub

image