Switch to circle 2.0 fixes #55
This commit is contained in:
Родитель
28cdaecbc4
Коммит
6c0b94fdfb
|
@ -0,0 +1,38 @@
|
|||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
machine: true
|
||||
working_directory: ~/experimenter
|
||||
steps:
|
||||
- run:
|
||||
name: Install Docker Compose
|
||||
command: |
|
||||
set -x
|
||||
sudo bash -c "curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose"
|
||||
sudo chmod +x /usr/local/bin/docker-compose
|
||||
- run:
|
||||
name: Docker info
|
||||
command: docker -v
|
||||
- run:
|
||||
name: Docker compose info
|
||||
command: docker-compose -v
|
||||
- checkout
|
||||
- run:
|
||||
name: Setting up .env
|
||||
command: cp .env.circle .env
|
||||
- run:
|
||||
name: Setting up docker-compose.yml
|
||||
command: mv docker-compose.yml.circleci docker-compose.yml
|
||||
- run:
|
||||
name: Run tests
|
||||
command: make check
|
||||
- deploy:
|
||||
command: |
|
||||
if [ "${CIRCLE_TAG}" ]; then
|
||||
[ -n \"$DOCKERHUB_REPO\" ]
|
||||
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
|
||||
echo ${DOCKERHUB_REPO}:${CIRCLE_TAG}
|
||||
docker tag app:build ${DOCKERHUB_REPO}:${CIRCLE_TAG}
|
||||
docker images
|
||||
docker push ${DOCKERHUB_REPO}:${CIRCLE_TAG}
|
||||
fi
|
57
circle.yml
57
circle.yml
|
@ -1,57 +0,0 @@
|
|||
machine:
|
||||
services:
|
||||
- docker
|
||||
|
||||
dependencies:
|
||||
# make sure to keep the docker cache dir
|
||||
pre:
|
||||
- sudo service postgresql stop
|
||||
- sudo /etc/init.d/postgresql stop
|
||||
- sudo apt-get remove -y postgresql-9.5
|
||||
- sudo apt-get remove -y postgresql-9.6
|
||||
- mv docker-compose.yml.circleci docker-compose.yml
|
||||
|
||||
cache_directories:
|
||||
- "~/docker"
|
||||
|
||||
override:
|
||||
- docker info
|
||||
|
||||
# build the container, use circleci's docker cache workaround
|
||||
# only use 1 image per day to keep the cache size from getting
|
||||
# too big and slowing down the build
|
||||
- I="image-$(date +%j).tar"; if [[ -e ~/docker/$I ]]; then echo "Loading $I"; docker load -i ~/docker/$I; fi
|
||||
|
||||
# setup env file
|
||||
- cp .env.circle .env
|
||||
|
||||
# build the container
|
||||
- make build
|
||||
|
||||
# Clean up any old images and save the new one
|
||||
- I="image-$(date +%j).tar"; mkdir -p ~/docker; rm ~/docker/*; docker save app:build > ~/docker/$I; ls -l ~/docker
|
||||
|
||||
test:
|
||||
override:
|
||||
- make check
|
||||
|
||||
# appropriately tag and push the container to dockerhub
|
||||
deployment:
|
||||
hub_latest:
|
||||
branch: "master"
|
||||
commands:
|
||||
- "[ -n \"$DOCKERHUB_REPO\" ]"
|
||||
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
|
||||
- "docker tag app:build ${DOCKERHUB_REPO}:latest"
|
||||
- "docker push ${DOCKERHUB_REPO}:latest"
|
||||
|
||||
hub_releases:
|
||||
# push all tags
|
||||
tag: /.*/
|
||||
commands:
|
||||
- "[ -n \"$DOCKERHUB_REPO\" ]"
|
||||
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
|
||||
- "echo ${DOCKERHUB_REPO}:${CIRCLE_TAG}"
|
||||
- "docker tag app:build ${DOCKERHUB_REPO}:${CIRCLE_TAG}"
|
||||
- "docker images"
|
||||
- "docker push ${DOCKERHUB_REPO}:${CIRCLE_TAG}"
|
|
@ -1,31 +1,39 @@
|
|||
app:
|
||||
image: app:build
|
||||
env_file: .env
|
||||
stdin_open: true
|
||||
tty: true
|
||||
expose:
|
||||
- "7001"
|
||||
links:
|
||||
- db
|
||||
command: ["/app/bin/wait-for-it.sh", "db:5432", "--", "python", "/app/manage.py", "runserver", "0:7001"]
|
||||
version: "3"
|
||||
|
||||
nginx:
|
||||
build: ./nginx
|
||||
links:
|
||||
- app
|
||||
ports:
|
||||
- "80:80"
|
||||
services:
|
||||
app:
|
||||
image: app:build
|
||||
env_file: .env
|
||||
stdin_open: true
|
||||
tty: true
|
||||
links:
|
||||
- db
|
||||
command: ["/app/bin/wait-for-it.sh", "db:5432", "--", "python", "/app/manage.py", "runserver", "0:7001"]
|
||||
networks:
|
||||
- private_nw
|
||||
|
||||
db:
|
||||
restart: always
|
||||
image: postgres:9.6
|
||||
volumes_from:
|
||||
- data
|
||||
ports:
|
||||
- "5432:5432"
|
||||
nginx:
|
||||
build: ./nginx
|
||||
links:
|
||||
- app
|
||||
ports:
|
||||
- "80:80"
|
||||
networks:
|
||||
- private_nw
|
||||
- public_nw
|
||||
|
||||
data:
|
||||
image: busybox
|
||||
volumes:
|
||||
- /var/lib/postgresql
|
||||
command: "true"
|
||||
db:
|
||||
restart: always
|
||||
image: postgres:9.6
|
||||
volumes:
|
||||
- db_volume:/var/lib/postgresql
|
||||
networks:
|
||||
- private_nw
|
||||
|
||||
volumes:
|
||||
db_volume:
|
||||
|
||||
networks:
|
||||
private_nw:
|
||||
internal: true
|
||||
public_nw:
|
||||
|
|
Загрузка…
Ссылка в новой задаче