Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev Setup: docker compose Fails for 2020+ Mac & arm64 Hardware #24

Closed
noi5e opened this issue Sep 30, 2024 · 1 comment
Closed

Dev Setup: docker compose Fails for 2020+ Mac & arm64 Hardware #24

noi5e opened this issue Sep 30, 2024 · 1 comment

Comments

@noi5e
Copy link
Contributor

noi5e commented Sep 30, 2024

  • docker compose build and docker compose up will fail on Mac computers newer than 2020+, aka anything with Apple Silicon or arm64 hardware.
  • sample gist containing stacktrace
  • This is because the postgis Docker image we use doesn't officially support arm64 hardware vs. the amd64/x86_64 in Intel chips.
  • relevant reading at postgis repo

Solution

I found a workaround using a community-run fork of the postgis image.

compose.yml:

services:
  db:
    container_name: db
-    build:
-      context: .
-      dockerfile: Dockerfile-db
+   image: imresamu/postgis-arm64:16-3.4.3-bullseye
    restart: always
    environment:
      POSTGRES_USER: nld_db_user
      POSTGRES_PASSWORD: nld_db_pass
      POSTGRES_DB: nld_dev_db
    ports:
      - 6543:5432
    volumes:
      - ./db:/docker-entrypoint-initdb.d/
      - database_volume:/var/lib/postgresql/data

volumes:
  database_volume:

.env:

DATABASE_URL="postgresql://nld_db_user:nld_db_pass@localhost:6543/nld_dev_db?schema=public"
DIRECT_URL="postgresql://nld_db_user:nld_db_pass@localhost:6543/nld_dev_db?schema=public"

Then:

  • docker compose build
  • docker compose up
  • npx prisma migrate dev
  • npx prisma db seed

I deleted Dockerfile-db and the setup seems to work just fine, I think that this could be removed in main as well.

I'm thinking the postgis image already includes functioning Postgres, so it's possibly redundant.

@noi5e
Copy link
Contributor Author

noi5e commented Sep 30, 2024

Closing this because there's nothing we can do about it until postgis officially supports arm64 images, which seems like a long horizon.

But at least this is here in case others run into the same thing

@noi5e noi5e closed this as completed Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant