Skip to content

Commit

Permalink
further runtime optimization for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
izelnakri committed Mar 1, 2020
1 parent 92616f0 commit 98522f0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 43 deletions.
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ jobs:
name: Build application Docker image
command: |
docker build -t paper_trail .
- run:
name: Install docker-compose
command: |
apk add docker-compose
- deploy:
name: Push application Docker image
command: |
DOCKER_TAG=$(echo paper_trail:${CIRCLE_BRANCH} | tr '/' '_')
DOCKER_TARGET_REMOTE="${HUB_USERNAME}/${DOCKER_TAG}"
sed -i $(echo "s/\$DOCKER_TAG/$DOCKER_TAG/g") /code/.env
echo $HUB_KEY | docker login -u $HUB_USERNAME --password-stdin
docker tag paper_trail "${DOCKER_TARGET_REMOTE}"
docker push "${DOCKER_TARGET_REMOTE}"
- run:
name: Pull and run a docker container
command: |
apk add docker-compose
sed -i $(echo "s/\$CIRCLE_BRANCH/$CIRCLE_BRANCH/g") /code/.env
- run: docker-compose run paper_trail mix test test/paper_trail
- run: docker-compose run paper_trail mix test test/version
- run: docker-compose run paper_trail mix test test/uuid
Expand Down
5 changes: 3 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ 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 '/' '_')
# DOCKER_TAG=paper_trail:master
# DOCKER_TAG=$(echo paper_trail:${CIRCLE_BRANCH} | tr '/' '_')
DOCKER_TAG=$DOCKER_TAG
34 changes: 0 additions & 34 deletions circle.yml

This file was deleted.

4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ services:
volumes:
- pgdata:/var/lib/postgresql/data
paper_trail:
image: inakri/paper_trail:$CIRCLE_BRANCH
image: inakri/$DOCKER_TAG
build:
context: .
dockerfile: Dockerfile
cache_from:
- inakri/paper_trail:$CIRCLE_BRANCH
- inakri/$DOCKER_TAG
environment:
POSTGRES_USER: $POSTGRES_USER
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
Expand Down

0 comments on commit 98522f0

Please sign in to comment.