postal/.gitlab-ci.yml

69 lines
1.8 KiB
YAML
Raw Normal View History

2020-04-13 05:51:32 +02:00
#variables:
2020-04-13 05:37:04 +02:00
before_script:
- docker info
2020-04-13 05:54:14 +02:00
stages:
2020-04-17 06:55:28 +02:00
- build
2020-04-13 06:17:37 +02:00
- tests
2020-04-13 05:54:14 +02:00
2020-04-13 05:51:32 +02:00
build-docker-alpine:
2020-04-17 06:55:28 +02:00
stage: build
2020-04-13 05:37:04 +02:00
script:
- cd alpine
2020-04-13 05:51:32 +02:00
- docker build --network=host -t catdeployed/postal:alpine .
2020-04-13 06:34:38 +02:00
- docker save -o postal-alpine-container.tar catdeployed/postal:alpine
artifacts:
paths:
2020-04-13 06:55:33 +02:00
- alpine/postal-alpine-container.tar
2020-04-17 08:25:16 +02:00
expire_in: 1 day
2020-04-13 05:51:32 +02:00
build-docker-ubuntu:
2020-04-17 06:55:28 +02:00
stage: build
2020-04-13 05:51:32 +02:00
script:
- cd ubuntu
- docker build --network=host -t catdeployed/postal:ubuntu .
2020-04-13 06:34:38 +02:00
- docker save -o postal-ubuntu-container.tar catdeployed/postal:ubuntu
artifacts:
paths:
2020-04-13 06:37:36 +02:00
- ubuntu/postal-ubuntu-container.tar
2020-04-17 08:25:16 +02:00
expire_in: 1 day
2020-04-13 06:14:50 +02:00
test-docker-ubuntu:
stage: tests
script:
2020-04-13 07:11:28 +02:00
- cd ubuntu
- docker load -i postal-ubuntu-container.tar
2020-04-13 06:53:20 +02:00
- docker-compose up -d
2020-04-17 08:28:19 +02:00
- for i in {1..20}; do [ $(docker inspect postal | jq '.[].State.Health.Status') == "healthy" ] && break || sleep 15; done
2020-04-13 07:19:29 +02:00
after_script:
2020-04-13 07:57:28 +02:00
- cd ubuntu
2020-04-13 07:19:29 +02:00
- docker-compose rm -sfv
2020-04-14 05:07:32 +02:00
test-docker-alpine:
stage: tests
script:
- cd alpine
- docker load -i postal-alpine-container.tar
- docker-compose up -d
2020-04-18 22:27:44 +02:00
- for i in {1..20}; do [ $(docker inspect postal | jq '.[].State.Health.Status') == "healthy" ] && break || sleep 15; done
2020-04-14 05:07:32 +02:00
after_script:
- cd alpine
- docker-compose rm -sfv
2020-04-13 06:14:50 +02:00
2020-04-17 08:30:20 +02:00
#upload-images:
# stage: upload
# script:
# - docker load -i ubuntu/postal-ubuntu-container.tar
# - docker load -i alpine/postal-alpine-container.tar
# - docker tag catdeployed/postal:alpine catdeployed/postal:latest
# - docker login -u$DOCKER_USER -p$DOCKER_PASS
# - docker push catdeployed/postal:alpine
# - docker push catdeployed/postal:ubuntu
# - docker push catdeployed/postal:latest
# only:
# - master@CatDeployed/docker-postal
2020-04-13 06:53:20 +02:00
after_script:
2020-04-13 07:11:28 +02:00
- docker container prune -f
- docker image prune -f
- docker system prune -af --volumes