Commit e2b922c2 authored by Simon Cornet's avatar Simon Cornet
Browse files

feat: push image to gitlab registry

parent f6b6859a
Loading
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

variables:
  STORAGE_DRIVER: "overlay"
  IMAGE_TAG: "start-simoncor-net"

stages:
  - "build"
@@ -11,17 +12,17 @@ build:
  image: "quay.io/buildah/stable:latest"
  script:

    # login
    - "echo $CR_PASSWORD | buildah login -u $CR_USERNAME --password-stdin $CR_HOSTNAME"
    # login to container registry
    - "echo $CI_REGISTRY_PASSWORD | buildah login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY"

    # build image
    - "buildah bud -t start-simoncor-net -f Dockerfile.linux.amd64 ."
    - "buildah bud -t $IMAGE_TAG -f Dockerfile.linux.amd64 ."

    # tag image
    - "buildah tag start-simoncor-net cr.simoncor.net/siempie/start-simoncor-net:latest"
    # add tags to image
    - "buildah tag $IMAGE_TAG $CI_REGISTRY_IMAGE:latest"

    # push image
    - "buildah push cr.simoncor.net/siempie/start-simoncor-net:latest"
    - "buildah push $CI_REGISTRY_IMAGE:latest"

    # logout
    - "buildah logout $CR_HOSTNAME"
    # logout from container registry
    - "buildah logout $CI_REGISTRY"