-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/Sitecore/docker-images
# Conflicts: # README.md
- Loading branch information
Showing
7 changed files
with
247 additions
and
624 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
ARG BASE_IMAGE | ||
|
||
FROM $BASE_IMAGE as builder | ||
|
||
USER root | ||
|
||
RUN apt-get -y update \ | ||
&& apt-get -y --allow-unauthenticated install unzip \ | ||
&& wget -progress=bar:force -q -O sqlpackage.zip https://go.microsoft.com/fwlink/?linkid=2113331 \ | ||
&& unzip -qq sqlpackage.zip -d /opt/sqlpackage \ | ||
&& chmod +x /opt/sqlpackage/sqlpackage | ||
|
||
COPY *.zip /opt/wdp/ | ||
|
||
RUN unzip -qq /opt/wdp/Sitecore*scwdp.zip -d /opt/wdp/ | ||
|
||
COPY attach-databases.sh /opt/ | ||
COPY install-databases.sh /opt/ | ||
|
||
ENV DB_PREFIX='sc' | ||
|
||
RUN mkdir -p /install \ | ||
&& chmod -R 700 /install \ | ||
&& chmod +x /opt/*.sh \ | ||
&& cp /clean/* /install/ \ | ||
&& ( /opt/mssql/bin/sqlservr & ) | grep -q "Service Broker manager has started" \ | ||
&& ./opt/attach-databases.sh /install \ | ||
&& ./opt/install-databases.sh /opt/wdp | ||
|
||
FROM $BASE_IMAGE | ||
|
||
COPY --from=builder ["/install/*", "/clean/"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
dataDir=$1 | ||
|
||
for attempt in {1..10} | ||
do | ||
echo "### Connection attempt $attempt..." | ||
|
||
/opt/mssql-tools/bin/sqlcmd -S . -U sa -P $SA_PASSWORD -t 120 -l 120 -Q "SELECT Name from sys.Databases" >/dev/null 2>&1 | ||
|
||
if [[ $? == 0 ]]; then | ||
echo "### Connected." | ||
|
||
break | ||
else | ||
echo "### Retrying..." | ||
|
||
sleep 1 | ||
fi | ||
done | ||
|
||
echo "### Attaching databases in '$dataDir':" | ||
|
||
set -e | ||
|
||
echo "### Attaching databases now '$dataDir':" | ||
|
||
for filename in $dataDir/Sitecore.*.mdf; do | ||
[ -e "$filename" ] || continue | ||
|
||
fileBaseName=$(basename $filename .mdf) | ||
databaseName="${fileBaseName/_Primary/}" | ||
ldfPath="$dataDir/$fileBaseName.ldf" | ||
mdfPath=$filename | ||
|
||
echo "### Attaching '$databaseName' from '$mdfPath' and '$ldfPath'..." | ||
|
||
/opt/mssql-tools/bin/sqlcmd -S . -U sa -P $SA_PASSWORD -t 60 -l 300 -Q "CREATE DATABASE [$databaseName] ON (FILENAME = '$mdfPath'),(FILENAME = '$ldfPath') FOR ATTACH" | ||
done | ||
|
||
echo "### Databases ready." |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"tags": [ | ||
{ | ||
"tag": "sitecore-xp-sxa-ps-sql:9.3.0-linux", | ||
"build-options": [ | ||
"--build-arg BASE_IMAGE=sitecore-xp-sxa-sql:9.3.0-linux" | ||
] | ||
} | ||
], | ||
"sources": [ | ||
"Sitecore Publishing Module 9.3.0.0.scwdp.zip" | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
source=$1 | ||
|
||
for attempt in {1..10} | ||
do | ||
echo "### Connection attempt $attempt..." | ||
|
||
/opt/mssql-tools/bin/sqlcmd -S . -U sa -P $SA_PASSWORD -t 120 -l 120 -Q "SELECT Name from sys.Databases" >/dev/null 2>&1 | ||
|
||
if [[ $? == 0 ]]; then | ||
echo "### Connected." | ||
|
||
break | ||
else | ||
echo "### Retrying..." | ||
|
||
sleep 1 | ||
fi | ||
done | ||
|
||
echo "### Installing databases..." | ||
|
||
set -e | ||
|
||
for filename in $source/*.dacpac; do | ||
[ -e "$filename" ] || continue | ||
|
||
fileBaseName=$(basename $filename .dacpac) | ||
databaseName="Sitecore.${fileBaseName}" | ||
|
||
|
||
echo "### Installing '$databaseName' from '$filename'..." | ||
|
||
/opt/sqlpackage/sqlpackage /a:Publish /tsn:. /tdn:$databaseName /tu:sa /tp:$SA_PASSWORD /sf:$filename /tt:120 /q | ||
done |