Skip to content

Commit 1f1edff

Browse files
MariiaNazarchukMariiaNazarchuk
authored andcommitted
Add debugging tools and entrypoint.sh
1 parent 01be1cc commit 1f1edff

File tree

1 file changed

+31
-8
lines changed

1 file changed

+31
-8
lines changed

Dockerfile.dbupdate

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,53 @@
11
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
22
WORKDIR /app
33

4-
# copy dependencies
4+
# Copy dependencies
55
COPY ./Streetcode/DbUpdate/DbUpdate.csproj ./DbUpdate/
66
COPY ./Streetcode/DbUpdate/*.cs ./DbUpdate/
77
COPY ./Streetcode/DbUpdate/appsettings.IntegrationTests.json ./DbUpdate/
88
COPY ./Streetcode/Streetcode.WebApi/appsettings.Staging.json ./DbUpdate/
99
COPY ./Streetcode ./Streetcode/
10-
#COPY ./Streetcode/Streetcode.DAL/Persistence/ScriptsMigration /Streetcode.DAL/Persistence/ScriptsMigration/
11-
COPY ./Streetcode/Streetcode.DAL/Persistence/ScriptsMigration /app/ScriptsMigration/
12-
#RUN ls -la /tmp/ScriptsMigration
10+
COPY ./Streetcode/Streetcode.DAL/Persistence/ScriptsMigration /tmp/ScriptsMigration/
11+
RUN ls -la /tmp/ScriptsMigration
1312

1413
RUN dotnet restore ./DbUpdate/DbUpdate.csproj
1514

16-
# build
15+
16+
# Build
1717
RUN dotnet build ./DbUpdate/DbUpdate.csproj -c Release -o /app/build
1818

19-
# publishishing application
19+
# Publishishing application
2020
FROM build AS publish
2121
RUN dotnet publish ./DbUpdate/DbUpdate.csproj -c Release -o /app/publish
2222

2323
FROM mcr.microsoft.com/dotnet/runtime:7.0 AS runtime
2424
WORKDIR /app
25+
26+
# Install minimal debugging tools
27+
RUN apt-get update && apt-get install -y --no-install-recommends \
28+
iproute2 iputils-ping net-tools dnsutils && \
29+
rm -rf /var/lib/apt/lists/*
30+
31+
# Install SQL Server Command Line Tools
32+
RUN apt-get update && apt-get install -y curl gnupg
33+
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
34+
RUN curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
35+
RUN apt-get update && ACCEPT_EULA=Y apt-get install -y mssql-tools
36+
37+
# Update PATH to include mssql-tools
38+
ENV PATH="${PATH}:/opt/mssql-tools/bin"
39+
2540
COPY --from=publish /app/publish .
2641

2742
# Copy the ScriptsMigration folder from the build stage to the runtime image
28-
COPY --from=build /app/ScriptsMigration /app/ScriptsMigration/
43+
COPY --from=build /tmp/ScriptsMigration /app/ScriptsMigration/
44+
45+
# Set environment variable for runtime
46+
ENV ConnectionStrings__DefaultConnection="${ConnectionStrings__DefaultConnection}"
47+
48+
COPY entrypoint.sh /app/entrypoint.sh
49+
RUN chmod +x /app/entrypoint.sh
50+
51+
ENTRYPOINT ["/app/entrypoint.sh"]
2952

30-
CMD ["dotnet", "DbUpdate.dll"]
53+
#CMD ["dotnet", "DbUpdate.dll"]

0 commit comments

Comments
 (0)