Skip to content

Instantly share code, notes, and snippets.

@adnan-kamili
Last active October 17, 2023 15:34
Show Gist options
  • Save adnan-kamili/8259b13be0b376cc444424668056cf51 to your computer and use it in GitHub Desktop.
Save adnan-kamili/8259b13be0b376cc444424668056cf51 to your computer and use it in GitHub Desktop.
asp.net-core-gitlab-heroku
# Official docker image.
image: docker:latest
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community nodejs-npm
- npm i -g heroku
deploy-develop:
stage: deploy
script:
- docker run -t -v $PWD:/app --workdir /app mcr.microsoft.com/dotnet/core/sdk:2.2 bash -c "dotnet restore && dotnet publish -c Release -o ./bin/Release/PublishOutput"
- docker build -t $CI_REGISTRY/my-awesome-app-dev/web .
- docker push $CI_REGISTRY/my-awesome-app-dev/web
# above two commands can be replaced with: "heroku container:push web --app my-awesome-app-dev"
- heroku container:release web --app my-awesome-app-dev
only:
- develop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment