Hi,
gitlab: 14.8.2
local docker on ubuntu: 20.4.04
gitlab running on ubuntu 20.04.4
working with .net6 sdk
I’m trying to create a yaml file that can deploy to my local docker.
Why I was trying to do is 3 stages: build, test, deploy
I tought the deploy stage should only build the docker image and push it to the registery, however i’m stuck on building the image.
My current project is a c# web api project, just the template weatherforecast, as it is just to test.
I deployed a runner to execute on docker as I do that always for my netcore projects.
So in the beginning I seem to have had a problem with ‘docker command not found’. As searching on stackoverflow I got my answer → change the privilage to true in the config.toml and then use docker image with custom version.
This seem to have fixed my problem but obviously, now I get dotnet not found and now I’m stuck here since I don’t know what to do here.
I tried to build my image with docker build $CI_COMMIT_BRANCH
now i tried docker build - < Dockerfile as descripted in the official docker dosc.
my yaml:
image: mcr.microsoft.com/dotnet/sdk:latest
stages:
- build
- test
- deploy
before_script:
- cd Test
- dotnet restore Test.sln
build:
stage: build
tags:
- dev
script:
- 'dotnet build --no-restore Test.sln'
tests:
stage: test
tags:
- dev
script:
- 'dotnet test --no-restore Test.sln'
deploy:
stage: deploy
environment: production
image: docker:latest
tags:
- dev
script:
- cd Test
- docker build - < Dockerfile