Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SA_PASSWORD=P@ssword1!
MSSQL_PID=Developer
INSERT_SIMULATED_DATA=true
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.bacpac filter=lfs diff=lfs merge=lfs -text
.bak filter=lfs diff=lfs merge=lfs -text
37 changes: 27 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,47 @@ ENV SQLCMDPASSWORD=${SA_PASSWORD}
ENV MSSQL_PID=${MSSQL_PID:-Developer}
ENV INSERT_SIMULATED_DATA=${INSERT_SIMULATED_DATA:-false}

# Install dependencies for sqlpackage
RUN apt-get update && \
apt-get install -y \
wget \
unzip \
libicu-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Copy in scripts
COPY docker-entrypoint.sh /
COPY healthcheck.sh /
COPY scripts /scripts

COPY sqlcmd /sqlcmd

# If the architecture is arm copy in the correct sqlcmd
RUN if [ "$(uname -m)" = "aarch64" ]; then \
cp sqlcmd/linux-arm64 /usr/bin/sqlcmd; \
elif [ "$(uname -m)" = "x86_64" ]; then \
cp sqlcmd/linux-x64 /usr/bin/sqlcmd; \
fi
# make sure the scripts directory is executable
RUN chmod -R +x /scripts

# Install sqlcmd
RUN cp sqlcmd/linux-x64 /usr/bin/sqlcmd;

# Install sqlpackage
RUN echo "Downloading sqlpackage for Linux..." && \
wget -q "https://aka.ms/sqlpackage-linux" -O /tmp/sqlpackage.zip && \
unzip -q /tmp/sqlpackage.zip -d /opt/sqlpackage && \
chmod +x /opt/sqlpackage/sqlpackage && \
echo "Verifying sqlpackage installation:" && \
/opt/sqlpackage/sqlpackage /version && \
rm /tmp/sqlpackage.zip && \
echo "sqlpackage installation complete"

# Set a Simple Health Check
HEALTHCHECK \
--interval=30s \
--retries=3 \
--start-period=10s \
--timeout=30s \
--timeout=60s \
CMD /healthcheck.sh

# Put CLI tools on the PATH
ENV PATH /opt/mssql-tools/bin:$PATH
# Put CLI tools on the PATH (including sqlpackage)
ENV PATH=/opt/mssql-tools/bin:/opt/sqlpackage:$PATH

# Create some base paths and place our provisioning script
RUN mkdir /docker-entrypoint-initdb.d && \
Expand Down
3 changes: 1 addition & 2 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ target "default" {
}
dockerfile = "Dockerfile"
platforms = [
"linux/amd64",
"linux/arm64"
"linux/amd64"
]
tags = [
"ghcr.io/design-group/${BASE_IMAGE_NAME}:${version}"
Expand Down
27 changes: 27 additions & 0 deletions docker-compose.dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

services:
database:
build:
context: .
platforms:
- linux/amd64 # Force x86-64 platform
platform: linux/amd64 # Force x86-64 platform
environment:
- MSSQL_STARTUP_DELAY=30 # Faster startup for development
- INSERT_SIMULATED_DATA=true # Enable simulated data insertion
volumes:
# Mount source code for development
- ./scripts:/scripts
- ./test/fixtures/init-sql:/docker-entrypoint-initdb.d
- ./healthcheck.sh:/healthcheck.sh
# Enable debug logging
command: ["/docker-entrypoint.sh", "/opt/mssql/bin/sqlservr", "--accept-eula"]
networks:
- default
- proxy

networks:
default:
proxy:
external: true
name: proxy
35 changes: 35 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

services:
database:
build: .
# image: ghcr.io/design-group/mssql-docker:latest
hostname: azure-sql-db
volumes:
- ./test/fixtures:/backups
- ./test/fixtures/simulated-data:/simulated-data
- ./test/integration:/test-scripts
environment:
SA_PASSWORD: ${SA_PASSWORD:-}
healthcheck:
test: ["CMD", "/healthcheck.sh"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
labels:
traefik.enable: true
traefik.hostname: azure-sql-db
traefik.tcp.routers.azure-sql-db.entrypoints: "azure-sql"
traefik.tcp.routers.azure-sql-db.tls: false
traefik.tcp.routers.azure-sql-db.rule: "HostSNI(`*`)"
traefik.tcp.routers.azure-sql-db.service: "azure-sql-db-svc"
traefik.tcp.services.azure-sql-db-svc.loadbalancer.server.port: 1433
networks:
- default
- proxy

networks:
default:
proxy:
external: true
name: proxy
Loading