Skip to content

Commit

Permalink
Updated to fix docker build paths
Browse files Browse the repository at this point in the history
  • Loading branch information
mitch-b committed Dec 18, 2024
1 parent 925fd8b commit a049d5b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ jobs:
- name: Build and push API image
uses: docker/build-push-action@v5
with:
context: ./src/OpenWish.ApiService
context: ./src
file: ./src/OpenWish.Api/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-api.outputs.tags }}
labels: ${{ steps.meta-api.outputs.labels }}
Expand All @@ -68,7 +69,8 @@ jobs:
- name: Build and push Web image
uses: docker/build-push-action@v5
with:
context: ./src/OpenWish.Web
context: ./src
file: ./src/OpenWish.Web/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-web.outputs.tags }}
labels: ${{ steps.meta-web.outputs.labels }}
Expand Down
10 changes: 7 additions & 3 deletions src/OpenWish.ApiService/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
WORKDIR /src
COPY ["*.csproj", "./"]
RUN dotnet restore
# Copy solution and project files first
COPY ["OpenWish.ApiService/OpenWish.ApiService.csproj", "OpenWish.ApiService/"]
COPY ["OpenWish.Common/OpenWish.Common.csproj", "OpenWish.Common/"]
COPY ["OpenWish.Data/OpenWish.Data.csproj", "OpenWish.Data/"]
RUN dotnet restore "OpenWish.ApiService/OpenWish.ApiService.csproj"
# Copy the rest of the code
COPY . .
RUN dotnet publish -c Release -o /app/publish /p:UseAppHost=false
RUN dotnet publish "OpenWish.ApiService/OpenWish.ApiService.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
Expand Down
10 changes: 7 additions & 3 deletions src/OpenWish.Web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
WORKDIR /src
COPY ["*.csproj", "./"]
RUN dotnet restore
# Copy solution and project files first
COPY ["OpenWish.Web/OpenWish.Web.csproj", "OpenWish.Web/"]
COPY ["OpenWish.Common/OpenWish.Common.csproj", "OpenWish.Common/"]
COPY ["OpenWish.Data/OpenWish.Data.csproj", "OpenWish.Data/"]
RUN dotnet restore "OpenWish.Web/OpenWish.Web.csproj"
# Copy the rest of the code
COPY . .
RUN dotnet publish -c Release -o /app/publish /p:UseAppHost=false
RUN dotnet publish "OpenWish.Web/OpenWish.Web.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
Expand Down

0 comments on commit a049d5b

Please sign in to comment.