i’m desperate in need of help :(.
Oke, so i’m trying to deploy microservices to a local docker server. My attempt is that the ci/cd pipeline will do a docker build and then a docker push to the registery so my docker server can simply do a docker pull.
My first attempt works when using the shell executer. I have setup a vm as build server with all the tools installed that I need. → works like a charm
However i’d like to insert semantic release to my pipeline and transfer to docker executer.
Now the very very first attempt was already with the docker executer and that part failed.
Why? because my deployment part used the docker image which is necessary to use docker build Dockerfile; but in .net dockerfile includes dotnet publish command so I was continiously getting the error dotnet command not found.
Now I tought hey I can replicate my build server in my pipeline with a alpine image or in my case I used ubuntu. So In my deployment part I used ubuntu image installed docker and dotnet and the went on with my deployment script. → failed yet again :(.
my yaml: → script is what it needs to do and before script was trying to replicate build server and yes I know it’s complex.
image: Microsoft Artifact Registry
- dotnet restore Test.sln
- ‘dotnet build --no-restore Test.sln’
- ‘dotnet test --no-restore Test.sln’
- ‘echo installing prequisites’
- ‘apt update && apt upgrade -y’
- ‘apt install wget -y’
- ‘apt install curl -y’
- ‘echo done updating - installing dotnet’
- ‘wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb’
- ‘dpkg -i packages-microsoft-prod.deb’
- ‘rm packages-microsoft-prod.deb’
- ‘echo installing docker’
- ‘apt update’
- ‘apt install ca-certificates gnupg lsb-release -y’
- ‘mkdir -p /etc/apt/keyrings’
- ‘curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg’
- ‘echo “deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] Index of linux/ubuntu/ $(lsb_release -cs) stable” | tee /etc/apt/sources.list.d/docker.list > /dev/null’
- ‘apt update’
- ‘apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y’
- ‘docker --version’
- ‘apt update’
- ‘apt install docker-compose -y’
- ‘docker-compose --version’
- ‘echo done with prequicites’
- ‘docker-compose build’
- ‘echo $dockerHub >> pw.txt’
- ‘cat pw.txt | docker login --username technologyresearcher --password-stdin’
- ‘docker push technologyresearcher/test:latest’
- ‘rm pw.txt’
The problem here is that docker-compose build gives my python errors which I don’t heck know about, but since it is throwing me filenotfound I assume it is search for something, or in this case I think it is stuck on connecting to the outside.
Oke, so What i’m looking for is A) what is the error how can I fix this?
B) if i’m doing it totally wrong, give some information, guides, any internet source cause, I don’t find any sources to deploy with gitlab and microservices at the same time.
so after alternating my yaml file the first attempt I had a problem on docker info.
when removing that I have got this and this is exactly what it tought it would do.
I think this is because the dockerfile contains a dotnet command which cannot be found inside the docker image
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
COPY [“Test/Test.csproj”, “Test/”]
RUN dotnet restore “Test/Test.csproj”
COPY . .
RUN dotnet build “Test.csproj” -c Release -o /app/build
FROM build AS publish
RUN dotnet publish “Test.csproj” -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
COPY --from=publish /app/publish .
ENTRYPOINT [“dotnet”, “Test.dll”]