Skip to content
Snippets Groups Projects
Commit a309e4e6 authored by Quang tru HUYNH's avatar Quang tru HUYNH
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
Pipeline #71300 passed
# https://blog.revolve.team/2021/07/20/build-images-docker-gitlab-ci-sans-dind/
variables:
ARTIFACT_DIR: "./archive" # must be relative to the build directory - https://gitlab.com/gitlab-org/gitlab-foss/-/issues/15530
ARTIFACT_NAME: "built-with-buildah-example.tar"
STORAGE_DRIVER: "vfs"
BUILDAH_FORMAT: "docker"
stages:
- build
- push
default:
before_script:
- export TAG="${CI_COMMIT_TAG:-latest}" && echo $TAG # If the pipeline was triggered by a tag, use the tag value, otherwise use "latest"
build:
stage: "build"
image:
name: "quay.io/buildah/stable:v1.23.1"
script:
- "buildah bud -f Dockerfile -t ${CI_REGISTRY_IMAGE}:${TAG} ."
- "mkdir ${ARTIFACT_DIR}"
- "buildah push ${CI_REGISTRY_IMAGE}:${TAG} docker-archive:${ARTIFACT_DIR}/${ARTIFACT_NAME}:${TAG}"
artifacts:
name: "archive:${ARTIFACT_NAME}:${CI_JOB_ID}"
when: "on_success"
expire_in: "6h"
paths:
- "${ARTIFACT_DIR}/"
push:
stage: "push"
image:
name: "quay.io/buildah/stable:v1.23.1"
only:
- "tags"
- "main"
script:
- "buildah pull docker-archive:${ARTIFACT_DIR}/${ARTIFACT_NAME}"
- "echo $CI_REGISTRY_PASSWORD | buildah login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY"
- "buildah push ${CI_REGISTRY_IMAGE}:${TAG}"
dependencies:
- "build"
FROM busybox
MAINTAINER Tru Huynh <tru@pasteur.fr>
RUN date +"%Y-%m-%d-%H%M" > /last_update
This diff is collapsed.
# building a busybox toy system docker image with buildah for CI
Tru <tru@pasteur.fr>
## Why ?
- toy system for gitlab-CI
- build docker image from dockerhub registry and push to registry.pasteur.fr with proper tags
- using buildah instead of Docker IN Docker (dind)
-
## Caveat
- playground, use at your own risk!
- `:main` tagged docker image
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment