Created
June 13, 2020 15:24
-
-
Save chrisjmccrum/bd8cb915f9f5409c83120a8471cb0cef to your computer and use it in GitHub Desktop.
mssql-server-linux restore bacpac
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