This repository has been archived on 2025-12-28. You can view files and clone it, but cannot push or open issues or pull requests.
simple-blog-api/.gitlab-ci.yml
2021-06-03 13:05:53 +00:00

49 lines
1.4 KiB
YAML

.install_docker: &install_docker |
apt-get update
apt-get -y install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt-get update
apt-get -y install docker-ce
systemctl start docker
# This file is a template, and might need editing before it works on your project.
docker-build:
# Official docker image.
image: python:3.6.5
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
stage: build
tags:
- docker
before_script:
- *install_docker
- docker info
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
except:
- master
docker-build-master:
# Official docker image.
image: python:3.6.5
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
stage: build
tags:
- docker
before_script:
- *install_docker
- docker info
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE"
only:
- master