Skip to content

Commit 9277da6

Browse files
committed
Add Makefile, GitLab config
1 parent aa5bb21 commit 9277da6

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

.gitlab-ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
stages:
2+
- build
3+
4+
build-push-master:
5+
stage: build
6+
script:
7+
- make build
8+
- make push
9+
only:
10+
refs:
11+
- master
12+
13+
build-push-tag:
14+
stage: build
15+
script:
16+
- make build-tag
17+
- make push-tag
18+
only:
19+
- tags

Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.PHONY: help build build-tag push
2+
.DEFAULT_GOAL:= help
3+
.ONESHELL:
4+
5+
DOCKER_IMAGE = gpii/couchdb-statefulset-assembler
6+
7+
help: ## Prints list of tasks
8+
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' Makefile
9+
10+
build: ## Build image as latest
11+
docker build -t "${DOCKER_IMAGE}:latest" ./
12+
13+
build-tag: ## Build image as tag (use CI_COMMIT_TAG env var)
14+
@CI_COMMIT_TAG="$${CI_COMMIT_TAG:?Required variable not set}"
15+
docker build -t "${DOCKER_IMAGE}:${CI_COMMIT_TAG}" ./
16+
17+
push: ## Push image - latest
18+
docker push "${DOCKER_IMAGE}:latest"
19+
20+
push-tag: ## Push image - tag
21+
@CI_COMMIT_TAG="$${CI_COMMIT_TAG:?Required variable not set}"
22+
docker push "${DOCKER_IMAGE}:${CI_COMMIT_TAG}"

0 commit comments

Comments
 (0)