Setup docker and ci pipelines
This commit is contained in:
42
.gitlab-ci.yml
Normal file
42
.gitlab-ci.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
- publish
|
||||
|
||||
variables:
|
||||
DOCKER_IMAGE: registry.leon-hoppe.de/leon.hoppe/portfolio
|
||||
|
||||
build:
|
||||
stage: build
|
||||
image: mcr.microsoft.com/dotnet/sdk:9.0
|
||||
script:
|
||||
- dotnet restore
|
||||
- dotnet build --configuration Release --no-restore
|
||||
artifacts:
|
||||
paths:
|
||||
- "**/bin/Release"
|
||||
expire_in: 10 minutes
|
||||
|
||||
test:
|
||||
stage: test
|
||||
image: mcr.microsoft.com/dotnet/sdk:9.0
|
||||
script:
|
||||
- dotnet test --verbosity normal
|
||||
dependencies:
|
||||
- build
|
||||
|
||||
publish:
|
||||
stage: publish
|
||||
image: docker:latest
|
||||
services:
|
||||
- name: docker:dind
|
||||
alias: docker
|
||||
script:
|
||||
- export VERSION=$(echo $CI_COMMIT_TAG | sed 's/^v//')
|
||||
- docker login -u leon.hoppe -p ${CI_REGISTRY_PASSWORD} registry.leon-hoppe.de
|
||||
- docker build -t $DOCKER_IMAGE/api:$VERSION -f src/Portfolio.Api/Dockerfile .
|
||||
- docker build -t $DOCKER_IMAGE/web:$VERSION -f src/Portfolio.Web/Dockerfile .
|
||||
- docker push $DOCKER_IMAGE/api:$VERSION
|
||||
- docker push $DOCKER_IMAGE/web:$VERSION
|
||||
only:
|
||||
- tags
|
||||
Reference in New Issue
Block a user