-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
51 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
POSTGRES_USER=postgres | ||
POSTGRES_PASSWORD=postgres | ||
POSTGRES_HOST=localhost | ||
# PG_HOST=localhost | ||
MIX_ENV=test | ||
# CIRCLE_BRANCH=$$(if [ -v CIRCLE_BRANCH ]; then echo master; else git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'; fi) | ||
CIRCLE_BRANCH=$CIRCLE_BRANCH | ||
DOCKER_TAG=$(echo paper_trail:${CIRCLE_BRANCH} | tr '/' '_') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,40 @@ | ||
version: '3.2' | ||
version: '3.4' | ||
services: | ||
db: | ||
image: postgres:12.2-alpine | ||
environment: | ||
POSTGRES_PASSWORD: $PGUSER | ||
POSTGRES_USER: $PGPASSWORD | ||
POSTGRES_PASSWORD: $POSTGRES_USER | ||
POSTGRES_USER: $POSTGRES_PASSWORD | ||
PGDATA: /var/lib/postgresql/data/pgdata | ||
restart: always | ||
networks: | ||
- backend_network | ||
volumes: | ||
- pgdata:/var/lib/postgresql/data | ||
backend: | ||
image: $BACKEND_IMAGE_NAME | ||
image: inakri/paper_trail:$CIRCLE_BRANCH | ||
build: | ||
context: . | ||
dockerfile: $BACKEND_DOCKERFILE | ||
cache_from: | ||
- $BASE_IMAGE | ||
- $BACKEND_IMAGE_CACHE | ||
dockerfile: Dockerfile | ||
environment: | ||
PGUSER: $PGUSER | ||
PGPASSWORD: $PGPASSWORD | ||
PGPORT: $PGPORT | ||
POSTGRES_USER: $POSTGRES_USER | ||
POSTGRES_PASSWORD: $POSTGRES_PASSWORD | ||
PGPORT: 5432 | ||
PGHOST: db | ||
MIX_ENV: $MIX_ENV | ||
tty: true | ||
ports: | ||
- "4000:4000" | ||
depends_on: | ||
- db | ||
networks: | ||
- backend_network | ||
command: $BACKEND_COMMAND | ||
command: ["./setup-database.sh"] | ||
|
||
volumes: | ||
pgdata: | ||
networks: | ||
backend_network: | ||
driver: bridge | ||
|
||
# cache_from: | ||
# - $BASE_IMAGE | ||
# - $BACKEND_IMAGE_CACHE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# Prepare Dialyzer if the project has Dialyxer set up | ||
# if mix help dialyzer >/dev/null 2>&1 | ||
# then | ||
# echo "\nFound Dialyxer: Setting up PLT..." | ||
# mix do deps.compile, dialyzer --plt | ||
# else | ||
# echo "\nNo Dialyxer config: Skipping setup..." | ||
# fi | ||
|
||
# Wait for Postgres to become available. | ||
until psql -h $PG_HOST -U "$POSTGRES_USER" -c '\q' 2>/dev/null; do | ||
>&2 echo "Postgres is unavailable - sleeping" | ||
sleep 1 | ||
done | ||
|
||
echo "\nPostgres is available: continuing with database setup..." | ||
|
||
mix ecto.create | ||
# mix ecto.migrate | ||
|
||
# echo "\nPostgres migrations finished..." |