forked from enriquecatala/mssql-server-samplesdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-prepared-for-registry
70 lines (51 loc) · 2.24 KB
/
Dockerfile-prepared-for-registry
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
FROM mcr.microsoft.com/mssql/server:2017-CU20-ubuntu-16.04
EXPOSE 1433
LABEL "MAINTAINER" "Enrique Catalá Bañuls <[email protected]>"
LABEL "Project" "Microsoft SQL Server container with sample databases"
# Since SQL Server 2019 is non-root container, we need to force this to install packages
USER root
RUN apt-get update && apt-get install -y \
curl \
apt-transport-https
# Create the local_mountpoint folder where the restores will be happening
RUN mkdir -p /var/opt/mssql/data
RUN chown 10001:0 /var/opt/mssql/data
RUN chmod +rwx /var/opt/mssql/data
# Get to the default user
USER 10001
RUN mkdir -p /var/opt/mssql/backup
WORKDIR /var/opt/mssql/backup
##############################################################
# DATABASES SECTION
# 1) Add here the databases you want to have in your image
# 2) Edit setup.sql and include the RESTORE commands
#
# Adventureworks databases
#
RUN curl -L -o AdventureWorks2017.bak https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2017.bak
RUN curl -L -o AdventureWorks2016.bak https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2016.bak
RUN curl -L -o AdventureWorks2014.bak https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2014.bak
RUN curl -L -o AdventureWorks2012.bak https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2012.bak
# WideWorldImporters databases
#
RUN curl -L -o WideWorldImporters-Full.bak https://github.com/Microsoft/sql-server-samples/releases/download/wide-world-importers-v1.0/WideWorldImporters-Full.bak
# Tpcc, Pubs and Northwind
#
COPY ./Backups/Pubs.bak ./
COPY ./Backups/Northwind.bak ./
##############################################################
RUN mkdir -p /usr/config
WORKDIR /usr/config/
COPY setup.* ./
COPY entrypoint.sh ./
# Since SQL Server 2019 is non-root container, we need to force this to install packages
USER root
RUN chown -R 10001:0 setup.sh
RUN chown -R 10001:0 entrypoint.sh
# Get to the default user
USER 10001
RUN chmod +x setup.sh
RUN chmod +x entrypoint.sh
# This entrypoint start sql server, restores data and waits infinitely
ENTRYPOINT ["./entrypoint.sh"]
CMD ["sleep infinity"]