Docker Community Forums

Share and learn in the Docker community.

Docker-compose build speed issues VSTS and Docker for Windows


#1

Hi All,

I am having some speed issues with my docker-compose build on both docker for windows and on my Azure Devops Build pipeline, i am hoping that we have a few asp.net core and docker aficionados around here. Below are a few samples as i am pretty new to docker and have ended up building an entire application architecture around it now.

So my build times are about 22 mins (seems a bit excessive to me)

docker-compose snippet (there are of course many more services than this)

version: ‘3.7’

services:
nosql_data:
image: mongo

basket_data:
image: redis:alpine

rabbitmq:
image: rabbitmq:3-management-alpine

traefik:
image: traefik:1.6

identity_api:
image: myprojectname[dot]azurecr[dot]io/identity.api:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Identity/Identity.API/Dockerfile

basket_api:
image: myprojectname[dot]azurecr[dot]/basket.api:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Basket/Basket.API/Dockerfile
depends_on:
- basket_data
- identity_api
- rabbitmq

Dockerfile example (each service has its own docker-file

FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
WORKDIR /src

FROM microsoft/dotnet:2.1-sdk as dotnet-build
WORKDIR /src

FROM dotnet-build as build
WORKDIR /src
COPY . .
WORKDIR /src/src/Services/Identity/Identity.API
RUN dotnet restore -nowarn:msb3202,nu1503
RUN dotnet build --no-restore -c Release -o /app

FROM build AS publish
RUN dotnet publish --no-restore -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT [“dotnet”, “Identity.API.dll”]

if anyone can see me doing anything bizarre that would increase build times please point it out i would be very grateful to figure out what i am doing wrong!

happy to share screenshots of my azure devops build definitions if that helps

Many thanks
Joe.