|
1 | | -## |
| 1 | +# |
| 2 | +# Note: This image requires an active SLES15 subscription to build. |
| 3 | +# |
2 | 4 | # Thank you to our SUSE Partners for helping with this :) |
3 | | -##Assumptions |
| 5 | +# |
| 6 | +# Assumptions |
4 | 7 | # 1. use a matching version to the underlying build host |
5 | 8 | # 2. ensure it is registered to have access to needed repos |
6 | 9 | # then leveraging container-suseconnect-zypp |
|
12 | 15 | # All repositories have been refreshed. |
13 | 16 | # 3. minimize the layers by consolidating commands |
14 | 17 |
|
15 | | -## |
16 | | -# Base image |
17 | | -## |
18 | | -# Start with the appropriate base image |
19 | | -FROM registry.suse.com/suse/sles12sp5 |
| 18 | +FROM registry.suse.com/suse/sle15:15.3 |
20 | 19 |
|
21 | | -# add a needed (beyon minimal) dependency package this package is need so setcap can be used later on to provide the required privilages |
22 | | -RUN zypper in --no-confirm libcap-progs |
| 20 | +ENV ADDITIONAL_MODULES=sle-module-legacy |
23 | 21 |
|
24 | | -## |
25 | | -# Install the latest SQL 2019 build on SLES |
26 | | -## |
27 | | -# Add product repos / packages |
28 | | -# zypper refresh && \ |
| 22 | +RUN zypper install --no-confirm --no-recommends \ |
| 23 | + # install setcap to be used later |
| 24 | + # remove openldap2 version lock when https://bugzilla.suse.com/show_bug.cgi?id=1199594 is fixed |
| 25 | + # curl is needed for rpm import |
| 26 | + libcap-progs openldap2-2.4.46-150200.14.5.1 curl && \ |
| 27 | + rpm --import https://packages.microsoft.com/keys/microsoft.asc && \ |
| 28 | + zypper rm --no-confirm --clean-deps curl |
29 | 29 |
|
30 | | -RUN zypper addrepo --no-gpgcheck --refresh --check https://packages.microsoft.com/config/sles/12/mssql-server-2019.repo && \ |
31 | | - zypper --non-interactive install --no-confirm --auto-agree-with-licenses --auto-agree-with-product-licenses mssql-server |
| 30 | +# consider merging the two RUNs to save ~ 40mb at the cost of caching adding the signing key |
32 | 31 |
|
33 | | -RUN zypper addrepo --no-gpgcheck --refresh --check https://packages.microsoft.com/config/sles/12/prod.repo && \ |
34 | | - ACCEPT_EULA=Y zypper --non-interactive install mssql-tools |
| 32 | +# add mssql-server repo |
| 33 | +RUN zypper addrepo --no-check https://packages.microsoft.com/config/sles/15/mssql-server-2019.repo && \ |
| 34 | + zypper refresh packages-microsoft-com-mssql-server-2019 && \ |
| 35 | + # install mssql-server |
| 36 | + zypper install --no-confirm --auto-agree-with-licenses --no-recommends mssql-server && \ |
| 37 | + # add mssql-tools repo |
| 38 | + zypper addrepo --check https://packages.microsoft.com/config/sles/15/prod.repo && \ |
| 39 | + zypper refresh packages-microsoft-com-prod && \ |
| 40 | + # install mssql-tools (consider removing to reduce size) Microsoft already maintains a separate mssql-tools image |
| 41 | + ACCEPT_EULA=Y zypper install --no-confirm --no-recommends mssql-tools && \ |
| 42 | + zypper clean --all && \ |
| 43 | + # post installation of SQL Server the mssql user/group is created |
| 44 | + # so set the right permissions to the msssql folder |
| 45 | + mkdir -p -m 770 /var/opt/mssql && \ |
| 46 | + chown -R mssql /var/opt/mssql && \ |
| 47 | + # grant sql the permissions to connect to ports <1024 as a non-root user |
| 48 | + setcap 'cap_net_bind_service+ep' /opt/mssql/bin/sqlservr && \ |
| 49 | + # allow dumps from the non-root process |
| 50 | + setcap 'cap_sys_ptrace+ep' /opt/mssql/bin/paldumper && \ |
| 51 | + setcap 'cap_sys_ptrace+ep' /usr/bin/gdb && \ |
| 52 | + # ldconfig file because setcap causes the os to remove LD_LIBRARY_PATH |
| 53 | + # and other env variables that control dynamic linking |
| 54 | + mkdir -p /etc/ld.so.conf.d && \ |
| 55 | + touch /etc/ld.so.conf.d/mssql.conf && \ |
| 56 | + echo -e "# mssql libs\n/opt/mssql/lib" >> /etc/ld.so.conf.d/mssql.conf && \ |
| 57 | + ldconfig |
35 | 58 |
|
36 | | -# post the installation of SQL Server the mssql user/group is created |
37 | | -# so set the right permissions to the msssql folder |
38 | | -# |
39 | | -RUN mkdir -p -m 770 /var/opt/mssql && chown -R mssql. /var/opt/mssql |
40 | | - |
41 | | -# Grant sql the permissions to connect to ports <1024 as a non-root user |
42 | | -# |
43 | | -RUN setcap 'cap_net_bind_service+ep' /opt/mssql/bin/sqlservr |
44 | | - |
45 | | -# Allow dumps from the non-root process |
46 | | -# |
47 | | -RUN setcap 'cap_sys_ptrace+ep' /opt/mssql/bin/paldumper |
48 | | -RUN setcap 'cap_sys_ptrace+ep' /usr/bin/gdb |
49 | | - |
50 | | -#ldconfig file because setcap causes the os to remove LD_LIBRARY_PATH |
51 | | -# and other env variables that control dynamic linking |
52 | | -# |
53 | | -RUN mkdir -p /etc/ld.so.conf.d && touch /etc/ld.so.conf.d/mssql.conf |
54 | | -RUN echo -e "# mssql libs\n/opt/mssql/lib" >> /etc/ld.so.conf.d/mssql.conf |
55 | | -RUN ldconfig |
56 | | - |
57 | 59 | EXPOSE 1433 |
58 | | - |
| 60 | + |
59 | 61 | USER mssql |
60 | | - |
| 62 | + |
61 | 63 | CMD ["/opt/mssql/bin/sqlservr"] |
0 commit comments