Skip to content

Instantly share code, notes, and snippets.

@Nordes
Forked from zerda/.gitlab-ci.yml
Created January 24, 2018 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nordes/8dfea90c195824f8c066ef10a45331f3 to your computer and use it in GitHub Desktop.
Save Nordes/8dfea90c195824f8c066ef10a45331f3 to your computer and use it in GitHub Desktop.
Gitlab CI for ASP.Net Core project
image: microsoft/aspnetcore-build:1.1
variables:
PROJECT_DIR: "app"
cache:
key: "$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME"
paths:
- .nuget/
build:
stage: build
script:
- dotnet restore --packages .nuget/packages
- dotnet publish -c Release -o obj/Docker/publish
artifacts:
expire_in: 1 month
paths:
- $PROJECT_DIR/obj/Docker/publish/*
deploy:
stage: deploy
image: docker:latest
only:
- tags
script:
- cd $PROJECT_DIR/
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE:$CI_BUILD_TAG .
- docker push $CI_REGISTRY_IMAGE:$CI_BUILD_TAG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment