missioncontrol/.circleci/config.yml

97 строки
2.3 KiB
YAML

# These environment variables must be set in CircleCI UI
#
# DOCKERHUB_REPO - docker hub repo, format: <username>/<repo>
# DOCKER_USER - login info for docker hub
# DOCKER_PASS
#
version: 2
jobs:
build:
docker:
- image: circleci/node:8-jessie
steps:
- checkout
- setup_remote_docker
- run: ./bin/build
# save the built docker container into CircleCI's cache. This is
# required since Workflows do not have the same remote docker instance.
- run:
name: docker save app:build
command: mkdir -p /tmp; docker save -o /tmp/docker.tar "app:build"
- save_cache:
key: v1-{{ .Branch }}-{{epoch}}
paths:
- /tmp/docker.tar
- .env-dist
- Dockerfile
- docker-compose.yml
- docker-compose-ci.yml
test:
machine:
enable: true
environment:
DEVELOPMENT: 1
steps:
- checkout
- restore_cache:
key: v1-{{ .Branch }}
- run:
name: Restore Docker image cache
command: docker load -i /tmp/docker.tar
- run:
name: Install Docker Compose
command: |
curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
chmod +x ~/docker-compose
sudo mv ~/docker-compose /usr/local/bin/docker-compose
- run:
name: Test Code
command: |
cp .env-dist .env
docker-compose -f docker-compose-ci.yml run -e DEVELOPMENT test-ci
deploy:
docker:
- image: docker:18.02.0-ce
steps:
- checkout
- setup_remote_docker
- restore_cache:
key: v1-{{.Branch}}
- run:
name: Restore Docker image cache
command: docker load -i /tmp/docker.tar
- run:
name: Deploy to Dockerhub
command: ./bin/deploy
workflows:
version: 2
build-test-deploy:
jobs:
- build:
filters:
tags:
only: /.*/
- test:
requires:
- build
filters:
tags:
only: /.*/
- deploy:
requires:
- build
- test
filters:
tags:
only: /.*/
branches:
only: master