Skip to content

Instantly share code, notes, and snippets.

@tomkukral
Last active April 19, 2022 11:05
Show Gist options
  • Save tomkukral/7d94eb60774d351433036f3cc4546aad to your computer and use it in GitHub Desktop.
Save tomkukral/7d94eb60774d351433036f3cc4546aad to your computer and use it in GitHub Desktop.
Gitlab CI with buildah
export DOCKER_REGISTRY="docker.io"
export SERVICE="vp"
export ARTIFACT_TAG=$(git rev-parse HEAD)
# build image
buildah bud -t ${DOCKER_REGISTRY}/${SERVICE}:${ARTIFACT_TAG} .
# push
buildah push ${DOCKER_REGISTRY}/$(SERVICE):${ARTIFACT_TAG} docker://${DOCKER_REGISTRY}/${SERVICE}:${ARTIFACT_TAG}
[[runners]]
name = "Kubernetes Runner"
url = "https://gitlab.com/ci"
token = "{{ .gitlab_runner_token }}"
executor = "kubernetes"
[runners.kubernetes]
namespace = "gitlab"
[[runners.kubernetes.volumes.host_path]]
name = "docker"
mount_path = "/var/run/docker.sock"
read_only = false
[[runners.kubernetes.volumes.host_path]]
name = "buildah"
mount_path = "/var/lib/containers/"
read_only = false
FROM fedora
RUN dnf install -y \
buildah \
podman \
make \
&& \
dnf clean all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment