diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7c8c748..7fec2d1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,38 +1,66 @@ -docker-build: - # Use the official docker image. - # image: docker:latest - stage: build - # services: - # - docker:dind +stages: + - dind-build + +before_script: + - dnf install -y podman-docker + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + +# docker-build: +# # Use the official docker image. +# # image: docker:latest +# stage: build +# # services: +# # - docker:dind +# tags: +# - big-build +# before_script: +# - dnf install -y podman-docker +# - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY +# # Default branch leaves tag empty (= latest tag) +# # All other branches are tagged with the escaped branch name (commit ref slug) +# script: +# - | +# if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then +# tag="" +# echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" +# else +# tag=":$CI_COMMIT_REF_SLUG" +# echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" +# fi +# - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" . +# - docker push "$CI_REGISTRY_IMAGE${tag}" +# # Run this job in a branch where a Dockerfile exists +# rules: +# - if: $CI_COMMIT_BRANCH +# exists: +# - Dockerfile + + +build:prereleases: + stage: dind-build tags: - big-build - before_script: - - dnf install -y podman-docker - - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - # Default branch leaves tag empty (= latest tag) - # All other branches are tagged with the escaped branch name (commit ref slug) script: - - | - if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then - tag="" - echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" - else - tag=":$CI_COMMIT_REF_SLUG" - echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" - fi - - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" . - - docker push "$CI_REGISTRY_IMAGE${tag}" - # Run this job in a branch where a Dockerfile exists - rules: - - if: $CI_COMMIT_BRANCH - exists: - - Dockerfile - - - - - + - export IMAGE_TAG=$(echo -en $CI_COMMIT_REF_NAME | tr -c '[:alnum]_.-' '-') + - docker build --pull -t "$CI_REGISTRY_IMAGE:CI_PROJECT_NAME-$IMAGE_TAG" . + - docker push "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-$IMAGE_TAG" + only: + - branches + except: + - main +build:releases: + stage: dind-build + tags: + - big-build + script: + - export IMAGE_TAG=$(echo -en $CI_COMMIT_REF_NAME | tr -c '[:alnum]_.-' '-') + - docker build --pull -t "$CI_REGISTRY_IMAGE:CI_PROJECT_NAME-$IMAGE_TAG" . + - docker push "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-$IMAGE_TAG" + - docker tag "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-$IMAGE_TAG" "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-latest" + - docker push "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-latest" + only: + - tags # image: fedora:latest diff --git a/Dockerfile b/Dockerfile index 9e0d97b..2735bc8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1 +1,3 @@ -FROM registry.fedoraproject.org/fedora:latest \ No newline at end of file +FROM quay.io/podman/stable:latest + +RUN dnf install -y podman-docker buildah skopeo \ No newline at end of file