diff --git a/src/.dockerignore b/src/.dockerignore new file mode 100644 index 0000000..cd967fc --- /dev/null +++ b/src/.dockerignore @@ -0,0 +1,25 @@ +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/.idea +**/*.*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 \ No newline at end of file diff --git a/src/FitSync.API/Dockerfile b/src/FitSync.API/Dockerfile new file mode 100644 index 0000000..6e33c77 --- /dev/null +++ b/src/FitSync.API/Dockerfile @@ -0,0 +1,26 @@ +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base +USER $APP_UID +WORKDIR /app +EXPOSE 8080 +EXPOSE 8081 + +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["FitSync.API/FitSync.API.csproj", "FitSync.API/"] +COPY ["FitSync.Application/FitSync.Application.csproj", "FitSync.Application/"] +COPY ["FitSync.Domain/FitSync.Domain.csproj", "FitSync.Domain/"] +COPY ["FitSync.Infrastructure/FitSync.Infrastructure.csproj", "FitSync.Infrastructure/"] +RUN dotnet restore "FitSync.API/FitSync.API.csproj" +COPY . . +WORKDIR "/src/FitSync.API" +RUN dotnet build "FitSync.API.csproj" -c $BUILD_CONFIGURATION -o /app/build + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "FitSync.API.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "FitSync.API.dll"] diff --git a/src/FitSync.API/FitSync.API.csproj b/src/FitSync.API/FitSync.API.csproj index d019788..7536c98 100644 --- a/src/FitSync.API/FitSync.API.csproj +++ b/src/FitSync.API/FitSync.API.csproj @@ -4,6 +4,7 @@ net8.0 enable enable + Linux @@ -22,6 +23,12 @@ + + + .dockerignore + + + true bin\Debug\net8.0\FitSync.API.xml