diff --git a/.drone.yml b/.drone.yml index 7491ca7..cbb0b9e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -63,8 +63,8 @@ steps: - name: api-image-build-and-push image: plugins/docker settings: - dockerfile: docker/Dockerfile - context: . + dockerfile: API_SQLuedo/API/Dockerfile + context: API_SQLuedo/ registry: hub.codefirst.iut.uca.fr repo: hub.codefirst.iut.uca.fr/johnny.ratton/api_sqluedo username: diff --git a/API_SQLuedo/.dockerignore b/API_SQLuedo/.dockerignore new file mode 100644 index 0000000..fe1152b --- /dev/null +++ b/API_SQLuedo/.dockerignore @@ -0,0 +1,30 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md +!**/.gitignore +!.git/HEAD +!.git/config +!.git/packed-refs +!.git/refs/heads/** \ No newline at end of file diff --git a/API_SQLuedo/API/Dockerfile b/API_SQLuedo/API/Dockerfile new file mode 100644 index 0000000..e2db675 --- /dev/null +++ b/API_SQLuedo/API/Dockerfile @@ -0,0 +1,30 @@ +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base +USER app +WORKDIR /app +EXPOSE 8080 +EXPOSE 8081 + +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["API/API.csproj", "API/"] +COPY ["DbContextLib/DbContextLib.csproj", "DbContextLib/"] +COPY ["EntityFramework/Entities.csproj", "EntityFramework/"] +COPY ["Dto/Dto.csproj", "Dto/"] +COPY ["DbDataManager/DbDataManager.csproj", "DbDataManager/"] +COPY ["Model/Model.csproj", "Model/"] +COPY ["Shared/Shared.csproj", "Shared/"] +COPY ["StubbedContextLib/StubbedContextLib.csproj", "StubbedContextLib/"] +RUN dotnet restore "./API/./API.csproj" +COPY . . +WORKDIR "/src/API" +RUN dotnet build "./API.csproj" -c $BUILD_CONFIGURATION -o /app/build + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./API.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "API.dll"] \ No newline at end of file diff --git a/docker/.dockerignore b/docker/.dockerignore deleted file mode 100644 index ce8f61a..0000000 --- a/docker/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -**/*Test*.csproj \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 41a793a..0000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build -WORKDIR /app -COPY API_SQLuedo/ ./ - -# Restore dependencies -RUN dotnet restore API/API.csproj - -# Publish the application -RUN dotnet publish API/API.csproj -c Release -o /app/publish - -# Final image -FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base -WORKDIR /app -COPY --from=build /app/publish . -ENTRYPOINT ["dotnet", "./API.dll"]