2022-08-21 06:21:11 -04:00
|
|
|
variables:
|
|
|
|
&vars
|
|
|
|
export REGISTRY=code.balsillie.net && \
|
|
|
|
export REGISTRY_USER=michael && \
|
|
|
|
export ORGANIZATION=containers && \
|
|
|
|
export SOURCE_ORGANIZATION=mirrors && \
|
|
|
|
export REPO=matrix-service-synapse && \
|
|
|
|
export BUILD_ARGS="PYTHON_VERSION=3.10" && \
|
|
|
|
export DOCKERFILE="docker/Dockerfile" && \
|
|
|
|
export CONTEXT=.
|
|
|
|
|
|
|
|
workspace:
|
|
|
|
base: /git
|
|
|
|
path: pipeline
|
|
|
|
|
|
|
|
clone:
|
|
|
|
git:
|
|
|
|
image: woodpeckerci/plugin-git
|
|
|
|
|
2022-08-20 03:25:33 -04:00
|
|
|
pipeline:
|
2022-08-21 06:21:11 -04:00
|
|
|
check-tag:
|
2022-08-20 03:25:33 -04:00
|
|
|
image: debian:11-slim
|
2022-08-21 06:48:52 -04:00
|
|
|
pull: false
|
|
|
|
environment:
|
|
|
|
- SHELL=/bin/bash
|
2022-08-20 03:25:33 -04:00
|
|
|
commands:
|
2022-08-21 06:36:14 -04:00
|
|
|
- if [[ $TAG =~ ^v1\...\..rc.$ ]]
|
|
|
|
- then
|
|
|
|
- echo "Tag ${TAG} appears to be a release candidate, terminating build." && exit 1
|
|
|
|
- elif [[ $TAG =~ ^v1\...\..$ ]]
|
|
|
|
- then
|
|
|
|
- echo "Tag ${TAG} appears to be a release tag, proceeding." && exit 0
|
|
|
|
- else
|
|
|
|
- echo "Unable to determine nature of tag, terminating build." && exit 1
|
|
|
|
- fi
|
2022-08-21 06:21:11 -04:00
|
|
|
clone-source:
|
|
|
|
image: docker:git
|
|
|
|
commands:
|
|
|
|
- *vars
|
|
|
|
- git clone "https://${REGISTRY}/${SOURCE_ORGANIZATION}/${REPO}.git" /git/$REPO
|
|
|
|
- cd /git/$REPO
|
|
|
|
- git checkout $TAG
|
|
|
|
docker-build:
|
|
|
|
image: docker:latest
|
|
|
|
secrets:
|
|
|
|
- source: REGISTRY_PASSWORD
|
|
|
|
target: REGISTRY_PASSWORD
|
|
|
|
commands:
|
|
|
|
- *vars
|
|
|
|
- export DOCKER_BUILDKIT=1
|
|
|
|
- cd /git/$REPO
|
|
|
|
- echo $REGISTRY_PASSWORD | docker login $REGISTRY -u $REGISTRY_USER --password-stdin
|
|
|
|
- docker build \
|
|
|
|
-t $REGISTRY/$ORGANIZATION/$REPO:$TAG \
|
2022-08-21 06:28:46 -04:00
|
|
|
-t $REGISTRY/$ORGANIZATION/$REPO:$(date +%F) \
|
2022-08-21 06:21:11 -04:00
|
|
|
-t $REGISTRY/$ORGANIZATION/$REPO:latest \
|
|
|
|
--pull \
|
|
|
|
--build-arg $BUILD_ARGS \
|
|
|
|
-f $DOCKERFILE \
|
|
|
|
$CONTEXT
|
|
|
|
- docker push $REGISTRY/$ORGANIZATION/$REPO:latest
|