Skip to content

Commit

Permalink
Update Dockerfile to use the artifact produced by the GitHub Action w…
Browse files Browse the repository at this point in the history
…orkflow's dotnet publish step.
  • Loading branch information
feliperomero3 committed Nov 9, 2023
1 parent 144f112 commit 6e06409
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ExampleApp-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
- name: Test
run: dotnet test --no-build --configuration Release --verbosity normal ./src/ExampleApp.csproj
- name: Publish
run: dotnet publish --no-build --configuration Release --verbosity normal --output ./publish ./src/ExampleApp.csproj
run: dotnet publish --no-build --configuration Release --verbosity normal --output ./src/publish ./src/ExampleApp.csproj
- name: Upload publish artifact
uses: actions/upload-artifact@v3
with:
name: ExampleApp
path: ./publish
path: ./src/publish
- name: Login to DockerHub
uses: docker/login-action@v3.0.0
with:
Expand Down
13 changes: 1 addition & 12 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,7 @@ WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["ExampleApp.csproj", "."]
RUN dotnet restore "./ExampleApp.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "ExampleApp.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "ExampleApp.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
COPY /publish .
ENTRYPOINT ["dotnet", "ExampleApp.dll"]

0 comments on commit 6e06409

Please sign in to comment.