Hello, I have a Docker-Compose.yml that looks like the following:
version: '3.4'
services:
# Pricing API
service1:
image: service1
container_name: service1
build:
context: .
dockerfile: src/presentations/[somedir]/Dockerfile
ports:
- 5002:8080
volumes:
- service1volume001:/app/resources
- service1serilogvolume001:/app/serilog
restart: unless-stopped
volumes:
service1volume001:
service1serilogvolume001:
My Dockerfile looks like this:
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
# --------------- NEW STUFF HERE ----------------------
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS testing
ARG TEST_PROJECT_PATH="[path]"
ARG GITHUB_NUGET_ACCESS_TOKEN
WORKDIR /test
COPY ["Nuget.Config", "$TEST_PROJECT_PATH/"]
COPY . .
WORKDIR "/test/$TEST_PROJECT_PATH"
RUN dotnet restore --configfile "Nuget.Config"
RUN dotnet build
RUN dotnet test
# ---------------- END NEW STUFF -----------------------
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG GITHUB_NUGET_ACCESS_TOKEN
ARG PROJECT_PATH="[path]"
ARG PROJECT_NAME="[filename]"
WORKDIR /src
COPY ["$PROJECT_PATH/$PROJECT_NAME", "$PROJECT_PATH/"]
COPY ["Nuget.Config", "$PROJECT_PATH/"]
RUN dotnet restore --configfile "$PROJECT_PATH/Nuget.Config" "$PROJECT_PATH/$PROJECT_NAME"
COPY . .
WORKDIR "/src/$PROJECT_PATH"
RUN dotnet build --configfile "Nuget.Config" "$PROJECT_NAME" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish --configfile "Nuget.Config" "$PROJECT_NAME" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "[run_this]"]
USER root
RUN mkdir [all_needed_dirs]
The issue I am having is no matter what I do I cannot get this to pick up the new testing step and build it.
I have tried:
docker-compose --build --force-recreate
docker prune -a
docker-compose down && docker-compose up -d --no-cache
docker-compose down && docker rmi -f $(docker image ls -q)
Any help would be greatly appreciated, I am close to losing my mind!