Files
database-creation/db/Dockerfile
Thomas Nilles 2d1f55eea1 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
2026-02-22 09:36:38 -05:00

28 lines
685 B
Docker

# 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 \
"