diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..b692654 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,25 @@ +# 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 + - echo "$CI_REGISTRY_PASSWORD" | buildah login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY + 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