pycon.tw
pycon.tw copied to clipboard
[Deployment] Fail to build the Docker images
Description
Fail to build the Docker images from both Dockerfile and dev.Dockerfile:
- Cannot find the correct version of
psycopg2. - Cannot build
Pillowsuccessfully.
It turns out that this issue only happened on M1.
This could be solved by adding export DOCKER_DEFAULT_PLATFORM=linux/amd64 to your environment. I think we don't need to modify Dockerfile and docker-compose.yml only for running on M1 machines.
@josix agreed, but how about adding some comments hinting M1 users to solve such issue?
I added a checker in enter_dev_env.sh.to and set DOCKER_DEFAULT_PLATFORM to linux/amd64 when detecting the machine is arm64, please have a look, thanks! I'm not sure if there are other places that should notify users of this configuration, feel free to let me know if somewhere could be updated.
I guess this is solved by #1082, right? @mattwang44
IIRC it does work on some of our M1s but adding platform: x86_64 to each service defined in docker compose file seems to be a more common solution (I'm not sure how will this change affect other platforms, so I didnt check-in this change to the repo).
let's close it for now