nickjj / build-a-saas-app-with-flask

Learn how to build a production ready web app with Flask and Docker.
https://buildasaasappwithflask.com
MIT License
959 stars 189 forks source link

FLASK_ENV error in build #62

Closed jonathanlever closed 1 year ago

jonathanlever commented 2 years ago

Hi,

docker-compose up --build gives me ERROR: Invalid interpolation format for "build" option in service "x-app": "FLASK_ENV=${FLASK_ENV:-production}"

Ubuntu 18.04.6 LTS Docker version 20.10.12, build e91ed57 docker-compose version 1.21.2, build a133471

Thanks for any help to get this going

nickjj commented 2 years ago

Hi,

What happens if you update to Docker Compose version 1.27+ or higher? 1.21 is back from 2018. 1.27+ supports certain features that might be related to this error.

jonathanlever commented 2 years ago

that's a lot better, now I get through to

10% building 0/2 entries 2/2 dependencies 0/2 modulesBrowserslist: caniuse-lite is outdated. Please run: webpack_1 | npx browserslist@latest --update-db webpack_1 | webpack_1 | Why you should do it regularly: webpack_1 | https://github.com/browserslist/browserslist#browsers-data-updating snakeeyes_web_1 exited with code 1 snakeeyes_worker_1 exited with code 1 37% building 1/2 entries 17/17 dependencies 7/8 modulesBrowserslist: caniuse-lite is outdated. Please run: webpack_1 | npx browserslist@latest --update-db webpack_1 | webpack_1 | Why you should do it regularly: webpack_1 | https://github.com/browserslist/browserslist#browsers-data-updating 99% end closing watch compilation[webpack-cli] [Error: EACCES: permission denied, mkdir '/app/public/fonts'] { webpack_1 | errno: -13, webpack_1 | code: 'EACCES', webpack_1 | syscall: 'mkdir', webpack_1 | path: '/app/public/fonts' webpack_1 | } error Command failed with exit code 2. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. snakeeyes_webpack_1 exited with code 2

nickjj commented 2 years ago

What's the output of running id from your terminal?

I'm guessing your user and group are not both set to 1000? This is unfortunately an issue when wanting to run Docker containers as a non-root user and also wanting to use volumes. This issue only happens on native Linux btw but it can be worked around.

jonathanlever commented 2 years ago

I get uid=1001(azureuser) gid=1004(azureuser) groups=1004(azureuser),27(sudo),101(systemd-journal),117(docker),1001(ciusers),1002(_azbatchgrp),1003(_azbatchsudogrp)

nickjj commented 2 years ago

I'm not familiar with Azure but is it possible to create a user there which has a uid:gid of 1000?

jonathanlever commented 2 years ago

I'm not very familiar with azure either. There is an existing user _azbatch with uid 1000 and group 1002

nickjj commented 2 years ago

Are you using it as a dev machine or deploying to production?

jonathanlever commented 2 years ago

currently dev

nickjj commented 2 years ago

What if you follow the steps here https://askubuntu.com/a/167400 to change the azureuser to 1000 for both the uid/gid? I'm not sure what the _azbatch user is tho. I've never seen a cloud hosting provider not give its initial user 1000:1000.

nickjj commented 1 year ago

This has now been fixed in https://github.com/nickjj/build-a-saas-app-with-flask/commit/30a0f347620f73c1caae614824548d64629a6d03 which allows you to build and run your containers with a custom uid/gid.