2023-06-14 12:52:42 +01:00
|
|
|
# https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#docker-alternatives
|
|
|
|
# Some details from https://major.io/2019/05/24/build-containers-in-gitlab-ci-with-buildah/
|
|
|
|
|
|
|
|
build:
|
|
|
|
stage: build
|
|
|
|
image: quay.io/buildah/stable
|
|
|
|
variables:
|
|
|
|
# Use vfs with buildah. Docker offers overlayfs as a default, but buildah
|
|
|
|
# cannot stack overlayfs on top of another overlayfs filesystem.
|
|
|
|
STORAGE_DRIVER: vfs
|
|
|
|
# You may need this workaround for some errors: https://stackoverflow.com/a/70438141/1233435
|
|
|
|
BUILDAH_ISOLATION: chroot
|
|
|
|
FQ_IMAGE_NAME: "$CI_REGISTRY_IMAGE/tcpproxy:$CI_COMMIT_SHORT_SHA"
|
|
|
|
FQ_IMAGE_REF_NAME: "$CI_REGISTRY_IMAGE/tcpproxy:$CI_COMMIT_REF_NAME"
|
|
|
|
before_script:
|
|
|
|
# Log in to the GitLab container registry
|
|
|
|
- export REGISTRY_AUTH_FILE=$HOME/auth.json
|
2023-06-14 12:58:01 +01:00
|
|
|
- echo "$CI_REGISTRY_PASSWORD" | buildah login --isolation=chroot -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
|
2023-06-14 12:52:42 +01:00
|
|
|
script:
|
|
|
|
- buildah images
|
|
|
|
- buildah build -t $FQ_IMAGE_NAME
|
|
|
|
- buildah tag $FQ_IMAGE_NAME $FQ_IMAGE_REF_NAME
|
|
|
|
- buildah images
|
|
|
|
- buildah push $FQ_IMAGE_NAME
|
|
|
|
- buildah push $FQ_IMAGE_REF_NAME
|