map docker sock, var expansion

This commit is contained in:
Michael Balsillie 2022-08-21 23:41:10 +12:00
parent a5c45fa690
commit f7a59b25b0

View File

@ -1,13 +1,13 @@
variables: variables:
&vars &vars
REGISTRY=code.balsillie.net - REGISTRY=code.balsillie.net
REGISTRY_USER=michael - REGISTRY_USER=michael
ORGANIZATION=containers - ORGANIZATION=containers
SOURCE_ORGANIZATION=mirrors - SOURCE_ORGANIZATION=mirrors
REPO=matrix-service-synapse - REPO=matrix-service-synapse
BUILD_ARGS="PYTHON_VERSION=3.10" - BUILD_ARGS="PYTHON_VERSION=3.10"
DOCKERFILE="docker/Dockerfile" - DOCKERFILE="docker/Dockerfile"
CONTEXT=. - CONTEXT=.
workspace: workspace:
base: /git base: /git
@ -25,27 +25,31 @@ pipeline:
- /bin/bash check-tag.sh - /bin/bash check-tag.sh
clone-source: clone-source:
image: docker:git image: docker:git
commands: environment:
- *vars *vars
- git clone https://$REGISTRY/$SOURCE_ORGANIZATION/$REPO.git /git/$REPO commands:
- cd /git/$REPO - git clone https://${REGISTRY}/${SOURCE_ORGANIZATION}/${REPO}.git /git/${REPO}
- cd /git/${REPO}
- git checkout $TAG - git checkout $TAG
docker-build: docker-build:
image: docker:latest image: docker:latest
secrets: secrets:
- source: REGISTRY_PASSWORD - source: REGISTRY_PASSWORD
target: REGISTRY_PASSWORD target: REGISTRY_PASSWORD
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
*vars
commands: commands:
- *vars
- export DOCKER_BUILDKIT=1 - export DOCKER_BUILDKIT=1
- cd /git/$REPO - cd /git/${REPO}
- echo $REGISTRY_PASSWORD | docker login $REGISTRY -u $REGISTRY_USER --password-stdin - echo $REGISTRY_PASSWORD | docker login ${REGISTRY} -u ${REGISTRY_USER} --password-stdin
- docker build - docker build
-t $REGISTRY/$ORGANIZATION/$REPO:$TAG -t ${REGISTRY}/${ORGANIZATION}/${REPO}:$TAG
-t $REGISTRY/$ORGANIZATION/$REPO:$(date +%F) -t ${REGISTRY}/${ORGANIZATION}/${REPO}:$(date +%F)
-t $REGISTRY/$ORGANIZATION/$REPO:latest -t ${REGISTRY}/${ORGANIZATION}/${REPO}:latest
--pull --pull
--build-arg $BUILD_ARGS --build-arg ${BUILD_ARGS}
-f $DOCKERFILE -f $}DOCKERFILE}
$CONTEXT ${CONTEXT}
- docker push $REGISTRY/$ORGANIZATION/$REPO:latest - docker push -a ${REGISTRY}/${ORGANIZATION}/${REPO}