Switch backend to wait for SQL Server and use direct INSERTs

Replace stored procedure calls with inline INSERT statements and
SCOPE_IDENTITY()
Add netcat for readiness check in new entrypoint.sh
Introduce dedicated SQL Server and init-db services in docker-compose
This commit is contained in:
2026-02-22 09:36:38 -05:00
parent c780dff015
commit 2d1f55eea1
6 changed files with 120 additions and 21 deletions

27
db/Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
# Dockerfile for DB init service
FROM mcr.microsoft.com/mssql/server:2022-latest
# Set SQL Server environment variables
ENV SA_PASSWORD=Ou812@12!@ \
ACCEPT_EULA=Y
# Set working directory inside the container
WORKDIR /usr/src/app
# Copy the initialization script and SQL file into the image
COPY --chmod=0755 init.sh .
COPY init.sql .
# Make the script executable
# Start SQL Server, wait until it is ready, then run the init script
CMD /opt/mssql/bin/sqlservr & \
/bin/bash -c "\
until /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P $$SA_PASSWORD -Q \"SELECT 1\" >/dev/null 2>&1; do \
sleep 1; \
done && \
./init.sh && \
tail -f /dev/null \
"