Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
.NET Core continous integration with Docker, Kubernetes, Gitlab and Google Cloud
# 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 1234@5678.com -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
You can’t perform that action at this time.