build by template

This commit is contained in:
Seraphim Strub 2023-01-26 22:36:50 +01:00
parent f628900110
commit adc5ad66b1

View file

@ -1,8 +1,7 @@
docker-build:
.docker-build: &docker_build
# Use the official docker image.
image: docker:latest
stage: build
services:
- docker:dind
before_script:
@ -18,10 +17,34 @@ docker-build:
tag=":$CI_COMMIT_REF_SLUG"
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
fi
- docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- docker push "$CI_REGISTRY_IMAGE${tag}"
- docker build --pull --build-arg GO_CMD=${GO_CMD} -t "$CI_REGISTRY_IMAGE/${GO_CMD}/${tag}" .
- docker push "$CI_REGISTRY_IMAGE/${GO_CMD}/${tag}"
# Run this job in a branch where a Dockerfile exists
rules:
- if: $CI_COMMIT_BRANCH
exists:
- Dockerfile
funbot:
stage: build
variables:
GO_CMD: funbot
<<: *docker_build
tempbot:
stage: build
variables:
GO_CMD: tempbot
<<: *docker_build
vcbot:
stage: build
variables:
GO_CMD: vcbot
<<: *docker_build
welcomebot:
stage: build
variables:
GO_CMD: welcomebot
<<: *docker_build