Commit 2f1f4ece authored by Simon Cornet's avatar Simon Cornet
Browse files

feat: push build to gitlab registry

parent d9534ac3
Loading
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

variables:
  STORAGE_DRIVER: "overlay"
  IMAGE_TAG: "hugo"

stages:
  - "build"
@@ -12,16 +13,16 @@ build:
  script:

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

    # build image
    - "buildah bud -t hugo -f Dockerfile.linux.amd64 ."
    - "buildah bud -t $IMAGE_TAG -f Dockerfile.linux.amd64 ."

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

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

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