Last active
February 26, 2021 15:26
-
-
Save flagbug/3098167f43085fbb6e7da40c7ca07783 to your computer and use it in GitHub Desktop.
SQL Server Linux Dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM microsoft/mssql-server-linux:2017-CU9 | |
ENV ACCEPT_EULA=Y | |
ENV SA_PASSWORD=yourStrong(!)Password | |
RUN apt-get update && apt-get install unzip -y | |
# SqlPackage taken from https://github.com/Microsoft/mssql-docker/issues/135#issuecomment-389245587 | |
RUN wget -O sqlpackage.zip https://go.microsoft.com/fwlink/?linkid=873926 \ | |
&& unzip sqlpackage.zip -d /tmp/sqlpackage \ | |
&& chmod +x /tmp/sqlpackage/sqlpackage | |
COPY database.bacpac /tmp/db/database.bacpac | |
# grep command to check if SQL server is already started taken from https://stackoverflow.com/a/51589787/488695 | |
RUN ( /opt/mssql/bin/sqlservr & ) | grep -q "Service Broker manager has started" \ | |
&& /tmp/sqlpackage/sqlpackage /a:Import /tsn:localhost,1433 /tdn:Database /tu:sa /tp:yourStrong(!)Password /sf:/tmp/db/database.bacpac \ | |
&& pkill sqlservr \ | |
&& rm /tmp/db/database.bacpac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment