version: "3" # Containers we are going to run services: # Our Phoenix container phoenix: # The build parameters for this container. build: # Here we define that it should build from the current directory context: . environment: # Variables to connect to our Postgres server APP_PORT: ${APP_PORT} APP_HOSTNAME: ${APP_HOSTNAME} DB_HOST: ${DB_HOST} SECRET_KEY_BASE: ${SECRET_KEY_BASE} DB_USER: postgres DB_PASSWORD: ${DB_PASSWORD} DB_PORT: 5432 ports: # Mapping the port to make the Phoenix app accessible outside of the container - "4000:4000" depends_on: # The db container needs to be started before we start this container - db db: # We use the predefined Postgres image image: postgres:9.6 environment: # Set user/password for Postgres POSTGRES_USER: ${DB_USER} POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_DB: coinsaver_prod # Set a path where Postgres should store the data PGDATA: /var/lib/postgresql/data/pgdata restart: always volumes: - pgdata:/var/lib/postgresql/data # Define the volumes volumes: pgdata: