Skip to content

Instantly share code, notes, and snippets.

@alediaferia
Created December 8, 2019 17:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alediaferia/f53c0a9805f4c010cd6d3ca1ed6cd032 to your computer and use it in GitHub Desktop.
Save alediaferia/f53c0a9805f4c010cd6d3ca1ed6cd032 to your computer and use it in GitHub Desktop.
GitLab CI example snippet for building and releasing images to Heroku
stages:
- build
- release
build_image:
only:
- master
image: registry.gitlab.com/majorhayden/container-buildah
stage: build
variables:
STORAGE_DRIVER: "vfs"
BUILDAH_FORMAT: "docker"
before_script:
- dnf install -y nodejs
- curl https://cli-assets.heroku.com/install.sh | sh
- sed -i '/^mountopt =.*/d' /etc/containers/storage.conf # https://major.io/2019/08/13/buildah-error-vfs-driver-does-not-support-overlay-mountopt-options/
script:
- buildah bud --iidfile iidfile -t cd-alediaferia:$CI_COMMIT_SHORT_SHA .
- buildah push --creds=_:$(heroku auth:token) $(cat iidfile) registry.heroku.com/cd-alediaferia/web
release:
only:
- master
image: node:10.17-alpine
stage: release
before_script:
- apk add curl bash
- curl https://cli-assets.heroku.com/install.sh | sh
script:
- heroku container:release -a cd-alediaferia web
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment