Yield generated for 2c769e01-44af-448d-9c96-5c79de4c2465
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

99 lines
2.6 KiB

version: 2
jobs:
build:
docker:
- image: circleci/python:latest
steps:
- checkout
- restore_cache:
key: deps1-{{ .Branch }}-{{ checksum "requirements/dev.txt" }}
- run:
name: Install Python deps in a venv
command: |
python3 -m venv venv
. venv/bin/activate
pip install -r requirements/dev.txt
- save_cache:
key: deps1-{{ .Branch }}-{{ checksum "requirements/dev.txt" }}
paths:
- "venv"
test:
docker:
- image: circleci/python:latest
environment:
DATABASE_URL: postgresql://ubuntu@localhost/circle_test?sslmode=disable
CONDUIT_SECRET: 'something-really-secret'
FLASK_APP: autoapp.py
FLASK_DEBUG: 1
- image: circleci/postgres:9.6.9-alpine
environment:
POSTGRES_USER: ubuntu
POSTGRES_PASSWORD: circle_test
POSTGRES_BD: ""
steps:
- checkout
- restore_cache:
key: deps1-{{ .Branch }}-{{ checksum "requirements/dev.txt" }}
- run:
name: wait for postgres
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run:
name: Tests Flask
command: |
. venv/bin/activate
flask db stamp head
flask db migrate
flask db upgrade
flask test
deploy:
docker:
- image: buildpack-deps:trusty
steps:
- checkout
- run:
name: heroku deploy
command: |
git push https://heroku:02467a97-3871-4afd-95ab-2b1a1c190165@git.heroku.com/warm-fortress-97103.git HEAD:main
docker-build-and-push:
docker:
- image: docker:17.05.0-ce-git
steps:
- checkout
- setup_remote_docker
- run:
name: Build application Docker image
command: |
docker build --cache-from=app -t app .
- deploy:
name: Publish application to docker hub
command: |
docker login -e $DOCKER_HUB_EMAIL -u $DOCKER_HUB_USER_ID -p $DOCKER_HUB_PWD
docker tag app $DOCKER_HUB_USER_ID/my-python-app:$CIRCLE_BUILD_NUM
docker tag app $DOCKER_HUB_USER_ID/my-python-app:latest
docker push $DOCKER_HUB_USER_ID/my-python-app:$CIRCLE_BUILD_NUM
docker push $DOCKER_HUB_USER_ID/my-python-app:latest
workflows:
version: 2
build-deploy:
jobs:
- build
- test:
requires:
- build
- deploy:
requires:
- build
- docker-build-and-push