Skip to content

Commit 3076856

Browse files
committed
#110 - Add Windows dockerfile
1 parent 4fa27cf commit 3076856

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

docker/windows/Dockerfile

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
FROM mcr.microsoft.com/windows/servercore:ltsc2019
2+
3+
COPY . C:/php-zephir-parser
4+
5+
# Download required functions for git installation
6+
RUN powershell.exe -Command \
7+
((new-object net.webclient).DownloadFile('https://raw.githubusercontent.com/actions/virtual-environments/5690645f0e91c30d888353d7b58432dc0466eca9/images/win/scripts/ImageHelpers/ChocoHelpers.ps1', 'C:\ChocoHelpers.ps1')); \
8+
((new-object net.webclient).DownloadFile('https://raw.githubusercontent.com/actions/virtual-environments/f93413492e47983bafbc29ab84cb697aeeb41f7b/images/win/scripts/ImageHelpers/InstallHelpers.ps1', 'C:\InstallHelpers.ps1')); \
9+
((new-object net.webclient).DownloadFile('https://raw.githubusercontent.com/actions/virtual-environments/b7f276c003aea42575b52247bdb2183e355fca2f/images/win/scripts/ImageHelpers/PathHelpers.ps1', 'C:\PathHelpers.ps1'));
10+
11+
# Install Choco and Git
12+
RUN powershell.exe -Command \
13+
Import-Module C:\ChocoHelpers.ps1; \
14+
Import-Module C:\InstallHelpers.ps1; \
15+
Import-Module C:\PathHelpers.ps1; \
16+
Invoke-Expression ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/actions/virtual-environments/main/images/win/scripts/Installers/Install-Choco.ps1')); \
17+
Invoke-Expression ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/actions/virtual-environments/main/images/win/scripts/Installers/Install-Git.ps1'));
18+
19+
# Clone 'virtual-environments'
20+
RUN powershell.exe git clone https://github.com/actions/virtual-environments.git
21+
22+
# Install all necessary dependecies
23+
RUN powershell.exe -Command \
24+
Import-Module C:\virtual-environments\images\win\scripts\ImageHelpers\PathHelpers.ps1; \
25+
Import-Module C:\virtual-environments\images\win\scripts\ImageHelpers\InstallHelpers.ps1; \
26+
Import-Module C:\virtual-environments\images\win\scripts\ImageHelpers\ChocoHelpers.ps1; \
27+
Import-Module C:\virtual-environments\images\win\scripts\ImageHelpers\VisualStudioHelpers.ps1; \
28+
Invoke-Expression C:\virtual-environments\images\win\scripts\Installers\Install-VCRedist.ps1; \
29+
Invoke-Expression C:\virtual-environments\images\win\scripts\Installers\Install-VS.ps1; \
30+
Invoke-Expression C:\virtual-environments\images\win\scripts\Installers\Install-PHP.ps1;
31+
32+
RUN curl -SL --output vs_buildtools.exe https://aka.ms/vs/16/release/vs_buildtools.exe && \
33+
(start /w vs_buildtools.exe --quiet --wait --norestart --nocache modify \
34+
--installPath "C:\BuildTools" \
35+
--add Microsoft.VisualStudio.Workload.AzureBuildTools \
36+
--remove Microsoft.VisualStudio.Component.Windows10SDK.10240 \
37+
--remove Microsoft.VisualStudio.Component.Windows10SDK.10586 \
38+
--remove Microsoft.VisualStudio.Component.Windows10SDK.14393 \
39+
--remove Microsoft.VisualStudio.Component.Windows81SDK) && \
40+
del /q vs_buildtools.exe
41+
42+
RUN dir "C:\BuildTools"
43+
44+
#RUN call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\Common7\\Tools\\VsDevCmd.bat"
45+
46+
ENV PHP_VERSION=8.0.9
47+
ENV PHP_MINOR=8.0
48+
ENV TEST_PHP_EXECUTABLE=C:/php/php.exe
49+
ENV BUILD_TYPE=ts
50+
ENV VC_VERSION=16
51+
ENV PHP_ARCH=x64
52+
ENV BUILD_VERSION=1
53+
54+
ENV PHP_SDK_VERSION=2.2.0
55+
ENV PHP_DEVPACK=C:/tools/php-devpack
56+
ENV PHP_SDK_PATH=C:/tools/php-sdk
57+
ENV EXTENSION_FILE=php_zephir_parser.dll
58+
59+
# choco install visualstudio2019-workload-vctools; \
60+
# choco install llvm; \
61+
RUN powershell.exe -Command \
62+
choco install 7zip; \
63+
Import-Module C:\php-zephir-parser\.ci\win-ci-tools.psm1; \
64+
SetupCommonEnvironment; \
65+
InstallPhpSdk; \
66+
InstallPhpDevPack; \
67+
AppendSessionPath;
68+
69+
RUN call C:\tools\php-sdk\bin\phpsdk_setvars.bat && \
70+
cd C:\php-zephir-parser\parser && \
71+
cl.exe lemon.c && \
72+
DEL zephir.c zephir.h parser.c scanner.c && \
73+
re2c.exe -o scanner.c scanner.re && \
74+
lemon.exe -s zephir.lemon && \
75+
ECHO #include ^<php.h^> > parser.c && \
76+
TYPE zephir.c >> parser.c && \
77+
TYPE base.c >> parser.c

0 commit comments

Comments
 (0)