Skip to content

Instantly share code, notes, and snippets.

@farhadnowzari
Created July 30, 2023 14:42
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 farhadnowzari/f29890a4b74f0b8c947adf1c76dd7011 to your computer and use it in GitHub Desktop.
Save farhadnowzari/f29890a4b74f0b8c947adf1c76dd7011 to your computer and use it in GitHub Desktop.
gitlab ci sample
image: mcr.microsoft.com/dotnet/sdk:6.0
variables:
PACKAGE_VERSION: 1.0.0
IMAGE_TAG: saga-service:$PACKAGE_VERSION
stages:
- build
- publish
build_backend:
stage: build
script:
- echo "Compiling..."
- dotnet build -c Release
- dotnet publish -c Release
artifacts:
untracked: true
when: on_success
paths:
- "bin/Release/net6.0/"
expire_in: "1 day"
publish_container:
image: docker:20.10.16
stage: publish
dependencies:
- build_backend
variables:
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_CERTDIR: "/certs"
DOCKER_TLS_VERIFY: 1
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
services:
- docker:20.10.16-dind
script:
- echo "Deploying..."
- docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -t $CI_REGISTRY/nowzarifarhad/sagaorchestrator/$IMAGE_TAG .
- docker push $CI_REGISTRY/nowzarifarhad/sagaorchestrator/$IMAGE_TAG
only:
- main
- dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment