我有以下与 microsoft/iis 一起使用,但我想让它与较小的 nanoserver 一起使用。当我用 nanoserver/iis 替换 microsoft/iis 时,这条线失败了。是不是因为 exe 文件无法在 nanoserver 中运行?
C:\vc_redist-x64.exe /quiet /install
FROM nanoserver/iis
这有效:
FROM microsoft/iis
ADD PHP_7.3.26-NTS.zip C:\\php.zip
#unzip
RUN powershell -Command "expand-archive -Path 'c:\php.zip' -DestinationPath 'c:\test'"
#check path for source file php folder name if it changes!
RUN powershell -Command "Copy-item -Force -Recurse -Verbose 'c:\test\PHP_7.3.26-NTS' -Destination 'c:\php'"
ADD vc_redist-x64.exe C:\\vc_redist-x64.exe
ADD php_wincache.dll c:\\PHP\\ext\\php_wincache.dll
ADD php_pdo_sqlsrv_73_nts.dll c:\\PHP\\ext\\php_pdo_sqlsrv_73_nts.dll
ADD php_sqlsrv_73_nts.dll c:\\PHP\\ext\\php_sqlsrv_73_nts.dll
ADD php.ini C:\\php\\php.ini
# Enable required IIS Features
# Install VC Redist 14
# Configure IIS
# Configure system PATH
RUN dism.exe /Online /Enable-Feature /FeatureName:IIS-CGI /All && \
C:\vc_redist-x64.exe /quiet /install && \
del C:\vc_redist-x64.exe && \
%windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath='c:\php\php-cgi.exe'] && \
%windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='c:\php\php-cgi.exe',resourceType='Unspecified'] && \
[fullPath='c:\PHP\php-cgi.exe'].environmentVariables.[name='PHPRC',value='C:\PHP'] && \
setx PATH /M %PATH%;C:\PHP && \
setx PHP /M "C:\PHP"
# Optional: Add a starter page
RUN powershell.exe -Command "'<?php phpinfo(); ?>' | Out-File C:\inetpub\wwwroot\phpinfo.php" -Encoding UTF8
# ADD any application content and perform any configuration below
WORKDIR /inetpub/wwwroot
ADD web.config C:\\inetpub\\wwwroot\\web.config