Skip to content

Commit 618c500

Browse files
UbuntuUbuntu
authored andcommitted
Merge branch 'release/1.2.1'
2 parents 4395aa9 + 1f1edff commit 618c500

File tree

2 files changed

+98
-8
lines changed

2 files changed

+98
-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"]

entrypoint.sh

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "===== Starting dbupdate ====="
5+
echo " Date & Time: $(date)"
6+
echo " Working Directory: $(pwd)"
7+
echo " Directory Listing:"
8+
ls -la
9+
10+
echo ""
11+
echo " Network Info:"
12+
ip a
13+
echo ""
14+
echo " Routing Table:"
15+
ip route
16+
17+
echo ""
18+
echo " Checking DNS resolution (host.docker.internal):"
19+
getent hosts host.docker.internal || echo " Could not resolve host.docker.internal"
20+
21+
echo ""
22+
echo " Environment Variables (filtered):"
23+
printenv | grep -i connection || echo " No connection string in environment"
24+
printenv | grep -i sql || true
25+
26+
echo ""
27+
echo " Checking connection string..."
28+
if [ -z "$STREETCODE_ConnectionStrings__DefaultConnection" ]; then
29+
echo " No connection string found, using default connection string from environment"
30+
else
31+
echo " Using provided connection string"
32+
fi
33+
34+
echo ""
35+
echo " Checking if DbUpdate.dll exists..."
36+
if [ ! -f /app/DbUpdate.dll ]; then
37+
echo " ERROR: DbUpdate.dll not found!"
38+
exit 1
39+
else
40+
echo " DbUpdate.dll found"
41+
fi
42+
43+
echo ""
44+
echo " Connection string (masked password):"
45+
echo "$STREETCODE_ConnectionStrings__DefaultConnection" | sed -E 's/(Password=)[^;]*/\1***HIDDEN***/'
46+
47+
echo ""
48+
echo " Running dotnet with diagnostics enabled..."
49+
# Enable verbose dotnet diagnostics
50+
export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0
51+
export DOTNET_CLI_TELEMETRY_OPTOUT=1
52+
export DOTNET_PRINT_TELEMETRY_MESSAGE=false
53+
export DOTNET_EnableDiagnostics=1
54+
55+
echo "========== [RUNNING DBUPDATE] =========="
56+
57+
export DOTNET_LOG_LEVEL=Trace
58+
export DOTNET_TRACE=debug
59+
60+
dotnet /app/DbUpdate.dll | tee /app/dbupdate.log
61+
62+
echo ""
63+
echo " Checking contents of dbupdate.log..."
64+
cat /app/dbupdate.log || echo " dbupdate.log not found or empty."
65+
66+
echo ""
67+
echo " Done."

0 commit comments

Comments
 (0)