From dae6d559e5587ce4699989d809d3cdd930f47363 Mon Sep 17 00:00:00 2001 From: Hector Date: Mon, 8 Feb 2021 20:00:27 +0000 Subject: [PATCH 1/2] ci: add docker build to gitlab ci/cd (#3) Update the Gitlab CI/CD pipeline to include a step to build and push the project docker image. The CI/CD step uses existing Makefile commands to build the docker image. --- .gitlab-ci.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cb7bc76..ec69a9c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,3 +35,17 @@ build: - dist/*.tar.gz - dist/checksums.txt expire_in: 1 day + +docker-gitlab: + stage: build + image: docker:stable + services: + - docker:dind + before_script: + - apk add git + - apk add make + - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + script: + - make docker/build-latest + - make docker/build-tag + - docker push registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter From ac8ecfb1aafedb24be6b040ff7f18f655843fe62 Mon Sep 17 00:00:00 2001 From: Hector Date: Mon, 8 Feb 2021 20:07:56 +0000 Subject: [PATCH 2/2] ci: restrict docker build to main branch and tags (#3) --- .gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ec69a9c..dc3d272 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,6 +38,9 @@ build: docker-gitlab: stage: build + only: + - main + - tags image: docker:stable services: - docker:dind