mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-10 17:59:38 +08:00
50 lines
1.6 KiB
Docker
50 lines
1.6 KiB
Docker
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS builder
|
|
WORKDIR /
|
|
|
|
COPY ./.editorconfig ./
|
|
COPY ./global.json ./
|
|
COPY ./Directory.Build.props ./
|
|
|
|
# Setup working directory for the project
|
|
COPY ./src/BuildingBlocks/BuildingBlocks.csproj ./src/BuildingBlocks/
|
|
COPY ./src/Services/Flight/src/Flight/Flight.csproj ./src/Services/Flight/src/Flight/
|
|
COPY ./src/Services/Flight/src/Flight.Api/Flight.Api.csproj ./src/Services/Flight/src/Flight.Api/
|
|
COPY ./src/Aspire/src/ServiceDefaults/ServiceDefaults.csproj ./src/Aspire/src/ServiceDefaults/
|
|
|
|
# Restore nuget packages
|
|
RUN dotnet restore ./src/Services/Flight/src/Flight.Api/Flight.Api.csproj
|
|
|
|
# Copy project files
|
|
COPY ./src/BuildingBlocks ./src/BuildingBlocks/
|
|
COPY ./src/Services/Flight/src/Flight/ ./src/Services/Flight/src/Flight/
|
|
COPY ./src/Services/Flight/src/Flight.Api/ ./src/Services/Flight/src/Flight.Api/
|
|
COPY ./src/Aspire/src/ServiceDefaults/ ./src/Aspire/src/ServiceDefaults/
|
|
|
|
# Build project with Release configuration
|
|
# and no restore, as we did it already
|
|
|
|
RUN ls
|
|
RUN dotnet build -c Release --no-restore ./src/Services/Flight/src/Flight.Api/Flight.Api.csproj
|
|
|
|
WORKDIR /src/Services/Flight/src/Flight.Api
|
|
|
|
# Publish project to output folder
|
|
# and no build, as we did it already
|
|
RUN dotnet publish -c Release --no-build -o out
|
|
|
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0
|
|
|
|
# Setup working directory for the project
|
|
WORKDIR /
|
|
COPY --from=builder /src/Services/Flight/src/Flight.Api/out .
|
|
|
|
|
|
ENV ASPNETCORE_URLS https://*:443, http://*:80
|
|
ENV ASPNETCORE_ENVIRONMENT docker
|
|
|
|
EXPOSE 80
|
|
EXPOSE 443
|
|
|
|
ENTRYPOINT ["dotnet", "Flight.Api.dll"]
|
|
|