Skip to content

Commit c48937a

Browse files
committed
Remove docker-compose.yml and update Dockerfile for backend deployment
- Delete redundant docker-compose.yml file - Modify Dockerfile to improve build and deployment process - Add environment variable for Development mode - Copy appsettings configuration files directly into the container - Adjust build and publish commands for more precise deployment
1 parent 7021673 commit c48937a

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

backend/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@ COPY ["BlogApi.API/BlogApi.API.csproj", "BlogApi.API/"]
44
COPY ["BlogApi.Application/BlogApi.Application.csproj", "BlogApi.Application/"]
55
COPY ["BlogApi.Core/BlogApi.Core.csproj", "BlogApi.Core/"]
66
COPY ["BlogApi.Infrastructure/BlogApi.Infrastructure.csproj", "BlogApi.Infrastructure/"]
7+
78
RUN dotnet restore "BlogApi.API/BlogApi.API.csproj"
8-
COPY . ../
9+
COPY . .
910
WORKDIR /src/BlogApi.API
1011
RUN dotnet build "BlogApi.API.csproj" -c Release -o /app/build
1112

1213
FROM build AS publish
13-
RUN dotnet publish --no-restore -c Release -o /app/publish
14+
RUN dotnet publish "BlogApi.API.csproj" -c Release -o /app/publish /p:UseAppHost=false
1415

1516
FROM mcr.microsoft.com/dotnet/aspnet:9.0
1617
ENV ASPNETCORE_HTTP_PORTS=5001
18+
ENV ASPNETCORE_ENVIRONMENT=Development
1719
EXPOSE 5001
1820
WORKDIR /app
1921
COPY --from=publish /app/publish .
22+
COPY ["BlogApi.API/appsettings.json", "appsettings.json"]
23+
COPY ["BlogApi.API/appsettings.Development.json", "appsettings.Development.json"]
2024
ENTRYPOINT ["dotnet", "BlogApi.API.dll"]

backend/docker-compose.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)