From 0f3557ae92bf83d8c9462e9234a813f094e7f519 Mon Sep 17 00:00:00 2001 From: Almar Aubel Date: Sun, 14 Apr 2024 20:32:04 +0200 Subject: [PATCH] Fix docker build (#299) * fix(docker): Fix dbmirgrator docker image * fix(docker): Fix backend docker image --- docker-compose.yml | 5 +++-- src/Database/Dockerfile_DatabaseMigrator | 16 ++++++++++------ src/Directory.Packages.props | 6 +++--- src/Dockerfile | 4 +++- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f7f561d2a..b1b1c4fc4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,6 +18,7 @@ services: mymeetingsdb: build: ./src/Database/ + platform: linux/amd64 ports: - 1445:1433 networks: @@ -26,8 +27,8 @@ services: migrator: container_name: mymeetings_db_migrator build: - context: ./src/Database/ - dockerfile: Dockerfile_DatabaseMigrator + context: ./src/ + dockerfile: ./Database/Dockerfile_DatabaseMigrator networks: - starfish-crm-network environment: diff --git a/src/Database/Dockerfile_DatabaseMigrator b/src/Database/Dockerfile_DatabaseMigrator index fbe0c0e26..ece193bc2 100644 --- a/src/Database/Dockerfile_DatabaseMigrator +++ b/src/Database/Dockerfile_DatabaseMigrator @@ -4,12 +4,16 @@ WORKDIR /app FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /src -COPY ["DatabaseMigrator/DatabaseMigrator.csproj", "DatabaseMigrator.csproj"] -COPY ["DatabaseMigrator/DatabaseMigrator.csproj", "DatabaseMigrator.csproj"] +COPY ["./Database/DatabaseMigrator/DatabaseMigrator.csproj", "DatabaseMigrator.csproj"] +COPY ["Directory.Packages.props", "Directory.Packages.props"] +COPY ["Directory.Build.targets", "Directory.Build.targets"] +COPY ["Directory.Build.props", "Directory.Build.props"] +COPY ["stylecop.json", "stylecop.json"] +COPY [".editorconfig", ".editorconfig"] RUN dotnet restore "DatabaseMigrator.csproj" -COPY . . +COPY ./Database/ . WORKDIR "/src" RUN dotnet build "DatabaseMigrator.csproj" -c Release -o /app/build @@ -21,11 +25,11 @@ FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -ADD entrypoint_DatabaseMigrator.sh / -ADD CompanyName.MyMeetings.Database/Scripts/Migrations /migrations/ +ADD ./Database/entrypoint_DatabaseMigrator.sh / +ADD ./Database/CompanyName.MyMeetings.Database/Scripts/Migrations /migrations/ # Copy wait-for-it.sh into our image -COPY wait-for-it.sh wait-for-it.sh +COPY ./Database/wait-for-it.sh wait-for-it.sh # Make it executable, in Linux RUN chmod +x wait-for-it.sh diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 1f3aeb373..c7044f5e1 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -4,9 +4,9 @@ - - - + + + diff --git a/src/Dockerfile b/src/Dockerfile index 722402e42..131af02d2 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -14,7 +14,6 @@ COPY ["BuildingBlocks/Infrastructure/CompanyName.MyMeetings.BuildingBlocks.Infra COPY ["BuildingBlocks/Domain/CompanyName.MyMeetings.BuildingBlocks.Domain.csproj", "BuildingBlocks/Domain/"] COPY ["BuildingBlocks/Application/CompanyName.MyMeetings.BuildingBlocks.Application.csproj", "BuildingBlocks/Application/"] COPY ["Modules/UserAccess/Domain/CompanyName.MyMeetings.Modules.UserAccess.Domain.csproj", "Modules/UserAccess/Domain/"] -COPY ["BuildingBlocks/EventBus/CompanyName.MyMeetings.BuildingBlocks.EventBus.csproj", "BuildingBlocks/EventBus/"] COPY ["Modules/Meetings/IntegrationEvents/CompanyName.MyMeetings.Modules.Meetings.IntegrationEvents.csproj", "Modules/Meetings/IntegrationEvents/"] COPY ["Modules/Meetings/Application/CompanyName.MyMeetings.Modules.Meetings.Application.csproj", "Modules/Meetings/Application/"] COPY ["Modules/Meetings/Domain/CompanyName.MyMeetings.Modules.Meetings.Domain.csproj", "Modules/Meetings/Domain/"] @@ -28,6 +27,9 @@ COPY ["Modules/Payments/Infrastructure/CompanyName.MyMeetings.Modules.Payments.I COPY ["Modules/Administration/Application/CompanyName.MyMeetings.Modules.Administration.Application.csproj", "Modules/Administration/Application/"] COPY ["Modules/Administration/Domain/CompanyName.MyMeetings.Modules.Administration.Domain.csproj", "Modules/Administration/Domain/"] COPY ["Modules/Administration/Infrastructure/CompanyName.MyMeetings.Modules.Administration.Infrastructure.csproj", "Modules/Administration/Infrastructure/"] +COPY ["Directory.Packages.props", "Directory.Packages.props"] +COPY ["Directory.Build.props", "Directory.Build.props"] +COPY ["Directory.Build.targets", "Directory.Build.targets"] RUN dotnet restore "API/CompanyName.MyMeetings.API/CompanyName.MyMeetings.API.csproj" COPY . . WORKDIR "/src/API/CompanyName.MyMeetings.API"