From 40f92bc48bc3d074d1f7cd50c8465f44d0b1cb40 Mon Sep 17 00:00:00 2001 From: max-ieremenko Date: Mon, 4 Nov 2024 15:43:49 +0100 Subject: [PATCH] update to latest mssql/server image --- .../create-database.dockerfile | 14 ++++++++++---- .../upgrade-database-scripts.dockerfile | 12 +++++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Examples/SqlServerDockerImage/create-database.dockerfile b/Examples/SqlServerDockerImage/create-database.dockerfile index 2cf2e4a6..8b3112f2 100644 --- a/Examples/SqlServerDockerImage/create-database.dockerfile +++ b/Examples/SqlServerDockerImage/create-database.dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/mssql-server-linux:latest AS build +FROM mcr.microsoft.com/mssql/server:latest AS build ENV ACCEPT_EULA=Y \ SA_PASSWORD=P@ssw0rd \ @@ -7,11 +7,14 @@ ENV ACCEPT_EULA=Y \ # copy scripts COPY create-database-scripts/ /sql-scripts/ -# install .net 6.0 sdk +# switch to root +USER root + +# install .net 8.0 sdk RUN apt-get update && \ apt-get install -y apt-transport-https && \ apt-get update && \ - apt-get install -y dotnet-sdk-6.0 + apt-get install -y dotnet-sdk-8.0 # install SqlDatabase.GlobalTool RUN dotnet tool install --global SqlDatabase.GlobalTool @@ -27,7 +30,10 @@ RUN /opt/mssql/bin/sqlservr & \ -from=/sql-scripts && \ pkill sqlservr -FROM microsoft/mssql-server-linux:latest AS runtime +# set mssql user as SqlServer files owner +RUN chown -R mssql /var/opt/mssql/data + +FROM mcr.microsoft.com/mssql/server:latest AS runtime ENV ACCEPT_EULA=Y \ SA_PASSWORD=P@ssw0rd \ diff --git a/Examples/SqlServerDockerImage/upgrade-database-scripts.dockerfile b/Examples/SqlServerDockerImage/upgrade-database-scripts.dockerfile index 1b4fba3e..074c119e 100644 --- a/Examples/SqlServerDockerImage/upgrade-database-scripts.dockerfile +++ b/Examples/SqlServerDockerImage/upgrade-database-scripts.dockerfile @@ -4,11 +4,14 @@ FROM sqldatabase/mssql-server-linux-demo:create AS build # copy scripts COPY upgrade-database-scripts/ /sql-scripts/ -# install .net 6.0 sdk +# switch to root +USER root + +# install .net 8.0 sdk RUN apt-get update && \ apt-get install -y apt-transport-https && \ apt-get update && \ - apt-get install -y dotnet-sdk-6.0 + apt-get install -y dotnet-sdk-8.0 # install SqlDatabase.GlobalTool RUN dotnet tool install --global SqlDatabase.GlobalTool @@ -24,7 +27,10 @@ RUN /opt/mssql/bin/sqlservr & \ -from=/sql-scripts && \ pkill sqlservr -FROM microsoft/mssql-server-linux:latest AS runtime +# set mssql user as SqlServer files owner +RUN chown -R mssql /var/opt/mssql/data + +FROM mcr.microsoft.com/mssql/server:latest AS runtime ENV ACCEPT_EULA=Y \ SA_PASSWORD=P@ssw0rd \