-
-
Save Nordes/8dfea90c195824f8c066ef10a45331f3 to your computer and use it in GitHub Desktop.
Gitlab CI for ASP.Net Core project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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