Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create bash scripts to avoid repeating the same dotnet build and restore command in the Dockerfile #252

Merged
merged 2 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading