Skip to content

Instantly share code, notes, and snippets.

@RyAndrew
Last active February 10, 2021 09:30
Show Gist options
  • Save RyAndrew/81789e99106620b07cec69f380e5fb21 to your computer and use it in GitHub Desktop.
Save RyAndrew/81789e99106620b07cec69f380e5fb21 to your computer and use it in GitHub Desktop.
dockerfile for basic apache on windows server 2019
# escape=`
FROM mcr.microsoft.com/windows/servercore:1809-amd64 as download
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENV APACHE_VERSION 2.4.46
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"
RUN Expand-Archive apache.zip -DestinationPath C:\ ; `
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"
RUN Expand-Archive apache_modules.zip -DestinationPath C:\apache_modules ; `
Remove-Item -Path apache_modules.zip
RUN C:\Windows\System32\curl --location --output vc_redist.x64.exe -A "Chrome" "https://aka.ms/vs/16/release/vc_redist.x64.exe"
RUN Start-Process '.\vc_redist.x64.exe' '/install /passive /norestart' -Wait; `
Remove-Item vc_redist.x64.exe
FROM mcr.microsoft.com/windows/servercore:1809-amd64
COPY --from=download C:\windows\system32\msvcp140.dll C:\windows\system32
COPY --from=download C:\windows\system32\vcruntime140.dll C:\windows\system32
COPY --from=download C:\Apache24 C:\server\programs\Apache24
RUN mkdir C:\server\data\ApacheConfigs && `
echo Include C:/server/data/ApacheConfigs/*.conf > C:\server\programs\Apache24\conf\httpd.conf
EXPOSE 80
CMD [ "C:\\server\\programs\\Apache24\\bin\\httpd.exe" ]
#mount in your configs and data:
#docker run -v C:/server/Data/ApacheConfigs:C:/server/Data/ApacheConfigs -v C:/server/Data/ApacheData/ip:C:/server/Data/ApacheData/ip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment