Skip to content

Commit

Permalink
Merge pull request #252 from DentallApp/patch-27
Browse files Browse the repository at this point in the history
Create bash scripts to avoid repeating the same dotnet build and restore command in the Dockerfile
  • Loading branch information
MrDave1999 authored May 1, 2024
2 parents df9658a + 037ad54 commit 21a237c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
27 changes: 7 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,17 @@ COPY ["src/Plugins/SendGrid/*.csproj", "src/Plugins/SendGrid/"]
COPY ["src/Plugins/TwilioWhatsApp/*.csproj", "src/Plugins/TwilioWhatsApp/"]
COPY ["src/Plugins/IdentityDocumentEcuador/*.csproj", "src/Plugins/IdentityDocumentEcuador/"]
COPY ["src/Plugins/*.props", "src/Plugins/"]
WORKDIR /app/src/Plugins/AppointmentReminders
RUN dotnet restore
WORKDIR /app/src/Plugins/ChatBot
RUN dotnet restore
WORKDIR /app/src/Plugins/SendGrid
RUN dotnet restore
WORKDIR /app/src/Plugins/TwilioWhatsApp
RUN dotnet restore
WORKDIR /app/src/Plugins/IdentityDocumentEcuador
RUN dotnet restore
COPY ["src/Plugins/*.sh", "src/Plugins/"]
WORKDIR /app/src/Plugins
RUN chmod u+x restore-plugins.sh
RUN ["./restore-plugins.sh"]

# Copy everything else and build plugins
COPY ["src/Shared/", "/app/src/Shared/"]
COPY ["src/Plugins/", "/app/src/Plugins/"]
WORKDIR /app/src/Plugins/AppointmentReminders
RUN dotnet build -c Release --no-restore
WORKDIR /app/src/Plugins/ChatBot
RUN dotnet build -c Release --no-restore
WORKDIR /app/src/Plugins/SendGrid
RUN dotnet build -c Release --no-restore
WORKDIR /app/src/Plugins/TwilioWhatsApp
RUN dotnet build -c Release --no-restore
WORKDIR /app/src/Plugins/IdentityDocumentEcuador
RUN dotnet build -c Release --no-restore
WORKDIR /app/src/Plugins
RUN chmod u+x build-plugins.sh
RUN ["./build-plugins.sh"]

# Copy everything else and build app
COPY ["src/", "/app/src/"]
Expand Down
6 changes: 6 additions & 0 deletions src/Plugins/build-plugins.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
for csprojFile in $(find -name "*.csproj" -type f)
do
echo "$csprojFile"
dotnet build "$csprojFile" -c Release --no-restore
done
6 changes: 6 additions & 0 deletions src/Plugins/restore-plugins.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
for csprojFile in $(find -name "*.csproj" -type f)
do
echo "$csprojFile"
dotnet restore "$csprojFile"
done

0 comments on commit 21a237c

Please sign in to comment.