11FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
22WORKDIR /app
33
4- # copy dependencies
4+ # Copy dependencies
55COPY ./Streetcode/DbUpdate/DbUpdate.csproj ./DbUpdate/
66COPY ./Streetcode/DbUpdate/*.cs ./DbUpdate/
77COPY ./Streetcode/DbUpdate/appsettings.IntegrationTests.json ./DbUpdate/
88COPY ./Streetcode/Streetcode.WebApi/appsettings.Staging.json ./DbUpdate/
99COPY ./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
1413RUN dotnet restore ./DbUpdate/DbUpdate.csproj
1514
16- # build
15+
16+ # Build
1717RUN dotnet build ./DbUpdate/DbUpdate.csproj -c Release -o /app/build
1818
19- # publishishing application
19+ # Publishishing application
2020FROM build AS publish
2121RUN dotnet publish ./DbUpdate/DbUpdate.csproj -c Release -o /app/publish
2222
2323FROM mcr.microsoft.com/dotnet/runtime:7.0 AS runtime
2424WORKDIR /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+
2540COPY --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