4c48cb8ea9
This fixes an error when running the mobilizon_api container (either with `make` or `docker-compose up`): the command `mix phx.server` was run first in the mobilizon_api container, but it made the container restart every ~10 seconds because of missing dependencies errors. As a result it became impossible to install the depencies using `docker-compose exec api sh -c "cd js && yarn install && cd ../"`, because that would give this error: `Error response from daemon: Container 8ff288ad74565bb0773f9b5f8fb39ab62925c16ea0ca77c5d2579cc3013a8464 is restarting, wait until the container is running`. This commit fixes this error by running the dependency installation commands (and compilation and db migration) before `mix phx.server`.
45 lines
1.0 KiB
YAML
45 lines
1.0 KiB
YAML
version: '3'
|
|
|
|
services:
|
|
postgres:
|
|
container_name: mobilizon_db
|
|
restart: unless-stopped
|
|
image: mdillon/postgis:11
|
|
environment:
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: mobilizon_dev
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
api:
|
|
container_name: mobilizon_api
|
|
restart: unless-stopped
|
|
build: .
|
|
volumes:
|
|
- '.:/app'
|
|
ports:
|
|
- "4000:4000"
|
|
depends_on:
|
|
- postgres
|
|
environment:
|
|
MIX_ENV: "dev"
|
|
MOBILIZON_INSTANCE_NAME: My Mobilizon Instance
|
|
MOBILIZON_INSTANCE_HOST: mobilizon.me
|
|
MOBILIZON_INSTANCE_EMAIL: noreply@mobilizon.me
|
|
MOBILIZON_INSTANCE_REGISTRATIONS_OPEN: "true"
|
|
MOBILIZON_DATABASE_PASSWORD: postgres
|
|
MOBILIZON_DATABASE_USERNAME: postgres
|
|
MOBILIZON_DATABASE_DBNAME: mobilizon_dev
|
|
MOBILIZON_DATABASE_HOST: postgres
|
|
command: >
|
|
sh -c "cd js &&
|
|
yarn install &&
|
|
cd ../ &&
|
|
mix deps.get &&
|
|
mix compile &&
|
|
mix ecto.create &&
|
|
mix ecto.migrate &&
|
|
mix phx.server"
|
|
volumes:
|
|
pgdata:
|
|
.:
|