-
-
Save wescleymatos/0374ba464bdc43f85a1d49249af2bd08 to your computer and use it in GitHub Desktop.
.NET Core continous integration with Docker, Kubernetes, Gitlab and Google Cloud
This file contains hidden or 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
# http://docs.gitlab.com/ce/ci/docker/using_docker_build.html#using-the-gitlab-container-registry | |
# The docker tag is the first 6 letters of the Git commit id | |
job_build_dotnet: | |
stage: build | |
image: microsoft/dotnet:latest | |
script: | |
- dotnet restore | |
- dotnet publish src/MyProject.Web -c Release | |
artifacts: | |
expire_in: 12 hrs | |
paths: | |
- src/MyProject.Web/bin/Release/netcoreapp1.1/publish/ | |
job_build_docker: | |
stage: deploy | |
image: docker:latest | |
services: | |
- docker:dind | |
script: | |
- export DOCKER_VERSION=$(echo "$CI_BUILD_REF" | cut -c 1-6) | |
- echo "$GOOGLE_AUTH_JSON" > google-cloud.json | |
- cd src/MyProject.Web && docker build -t gcr.io/my-kube-project/MyProject-web:$DOCKER_VERSION . | |
- cd ../../ && docker login -e [email protected] -u _json_key -p "$(cat google-cloud.json)" https://gcr.io | |
- docker push gcr.io/my-kube-project/MyProject-web:$DOCKER_VERSION | |
dependencies: | |
- job_build_dotnet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment