Move Dockerfile & NuGet.config to WebApi directory, update workflow
This commit is contained in:
@@ -55,6 +55,7 @@ jobs:
|
||||
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
cd src/FrontOffice.BFF.WebApi
|
||||
docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \
|
||||
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
|
||||
--build-arg HTTP_PROXY=http://proxyuser:87zH26nbqT2@46.249.98.211:3128 \
|
||||
|
||||
26
Dockerfile
26
Dockerfile
@@ -1,26 +0,0 @@
|
||||
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
||||
|
||||
ARG HTTP_PROXY
|
||||
ARG HTTPS_PROXY
|
||||
|
||||
ENV HTTP_PROXY=${HTTP_PROXY}
|
||||
ENV HTTPS_PROXY=${HTTPS_PROXY}
|
||||
ENV http_proxy=${HTTP_PROXY}
|
||||
ENV https_proxy=${HTTPS_PROXY}
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
COPY src/ ./
|
||||
COPY NuGet.config ./
|
||||
|
||||
RUN dotnet restore "FrontOffice.BFF.WebApi/FrontOffice.BFF.WebApi.csproj"
|
||||
RUN dotnet publish "FrontOffice.BFF.WebApi/FrontOffice.BFF.WebApi.csproj" -c Release -o /app/publish --no-restore
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/publish .
|
||||
|
||||
ENV ASPNETCORE_URLS=http://+:8080
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["dotnet", "FrontOffice.BFF.WebApi.dll"]
|
||||
37
src/FrontOffice.BFF.WebApi/Dockerfile
Normal file
37
src/FrontOffice.BFF.WebApi/Dockerfile
Normal file
@@ -0,0 +1,37 @@
|
||||
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
||||
WORKDIR /src
|
||||
|
||||
# Copy NuGet config
|
||||
COPY NuGet.config ./
|
||||
|
||||
# Copy solution file
|
||||
COPY ../FrontOffice.BFF.sln ./
|
||||
|
||||
# Copy all project files
|
||||
COPY FrontOffice.BFF.WebApi.csproj ./FrontOffice.BFF.WebApi/
|
||||
COPY ../FrontOffice.BFF.Application/*.csproj ./FrontOffice.BFF.Application/
|
||||
COPY ../FrontOffice.BFF.Infrastructure/*.csproj ./FrontOffice.BFF.Infrastructure/
|
||||
COPY ../FrontOffice.BFF.Domain/*.csproj ./FrontOffice.BFF.Domain/
|
||||
COPY ../Protobufs/*/*.csproj ./Protobufs/
|
||||
|
||||
# Restore with NuGet.config
|
||||
RUN dotnet restore "FrontOffice.BFF.WebApi/FrontOffice.BFF.WebApi.csproj" --configfile NuGet.config
|
||||
|
||||
# Copy all source code
|
||||
COPY . ./FrontOffice.BFF.WebApi/
|
||||
COPY ../FrontOffice.BFF.Application/ ./FrontOffice.BFF.Application/
|
||||
COPY ../FrontOffice.BFF.Infrastructure/ ./FrontOffice.BFF.Infrastructure/
|
||||
COPY ../FrontOffice.BFF.Domain/ ./FrontOffice.BFF.Domain/
|
||||
COPY ../Protobufs/ ./Protobufs/
|
||||
|
||||
# Build and publish
|
||||
RUN dotnet publish "FrontOffice.BFF.WebApi/FrontOffice.BFF.WebApi.csproj" -c Release -o /app/publish --no-restore
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/publish .
|
||||
|
||||
ENV ASPNETCORE_URLS=http://+:8080
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["dotnet", "FrontOffice.BFF.WebApi.dll"]
|
||||
Reference in New Issue
Block a user