Skip to content

Instantly share code, notes, and snippets.

@RyAndrew
Created February 10, 2021 09:31
Show Gist options
  • Save RyAndrew/8b64debb4338ac64f958ebb90dd42982 to your computer and use it in GitHub Desktop.
Save RyAndrew/8b64debb4338ac64f958ebb90dd42982 to your computer and use it in GitHub Desktop.
dockerfile for apache + php + sqlsrv for SQL 2008 on windows server 2019
# escape=`
FROM mcr.microsoft.com/windows/servercore:1809-amd64
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
#https://www.apachelounge.com/download/VS16/binaries/httpd-2.4.46-win64-VS16.zip
#https://www.apachehaus.com/downloads/httpd-2.4.46-lre323-x86-vs16.zip
RUN C:\Windows\System32\curl --location --output vc_redist.x64.exe -A "Chrome" "https://aka.ms/vs/16/release/vc_redist.x64.exe" ; `
Start-Process '.\vc_redist.x64.exe' '/install /passive /norestart' -Wait; `
Remove-Item vc_redist.x64.exe
RUN C:\Windows\System32\curl --location --output apache.zip -A "Chrome" "https://www.apachelounge.com/download/VS16/binaries/httpd-2.4.46-win64-VS16.zip" ; `
Expand-Archive apache.zip -DestinationPath C:\server\programs\ ; `
Remove-Item -Path apache.zip
RUN C:\Windows\System32\curl --location --output apache_modules.zip -A "Chrome" "https://www.apachelounge.com/download/VS16/modules/mod_fcgid-2.3.10-win64-VS16.zip" ; `
Expand-Archive apache_modules.zip -DestinationPath C:\apache_modules ; `
Remove-Item -Path apache_modules.zip ; `
mv C:/apache_modules/mod_fcgid-2.3.10/mod_fcgid.so C:/server/programs/Apache24/modules/mod_fcgid.so
RUN C:\Windows\System32\curl --location --output php.zip -A "Chrome" "https://windows.php.net/downloads/releases/php-7.4.15-nts-Win32-vc15-x64.zip" ; `
Expand-Archive php.zip -DestinationPath C:\server\programs\php ; `
Remove-Item -Path php.zip
#old version of sqlsrv required for SQL 2008 support
RUN C:\Windows\System32\curl --location --output php_sqlsrv.zip -A "Chrome" "https://github.com/microsoft/msphpsql/releases/download/v5.7.1-preview/Windows-7.4.zip" ; `
Expand-Archive php_sqlsrv.zip -DestinationPath C:\php_sqlsrv ; `
Remove-Item -Path php_sqlsrv.zip ; `
mv C:\php_sqlsrv\Windows-7.4\x64\php_sqlsrv_74_nts.dll C:\server\programs\php\ext\php_sqlsrv_74_nts.dll
#https://docs.microsoft.com/en-us/sql/connect/odbc/windows/release-notes-odbc-sql-server-windows?view=sql-server-ver15#previous-releases
RUN C:\Windows\System32\curl --location --output msodbcsql.msi -A "Chrome" "https://go.microsoft.com/fwlink/?linkid=2120355"
RUN Start-Process msiexec -Wait -ArgumentList @('/quiet','/passive','/qn','/i','msodbcsql.msi','IACCEPTMSODBCSQLLICENSETERMS=YES','ADDLOCAL=ALL') ; `
Remove-Item -Path msodbcsql.msi
SHELL ["cmd", "/S", "/C"]
RUN mkdir C:\server\data\ApacheConfigs && `
echo Include C:/server/data/ApacheConfigs/*.conf > C:\server\programs\Apache24\conf\httpd.conf
EXPOSE 80
#mount in your configs and data:
#docker run -v C:/server/Data:C:/server/Data
CMD [ "C:\\server\\programs\\Apache24\\bin\\httpd.exe" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment