-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.windows
More file actions
48 lines (35 loc) · 1.83 KB
/
Dockerfile.windows
File metadata and controls
48 lines (35 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Use Windows Server Core as the base image
FROM mcr.microsoft.com/windows/servercore:ltsc2025 AS builder
# Define build arguments
ARG VERSION="latest"
# Set PowerShell as the default shell
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Set working directory
WORKDIR C:/build
# Install Chocolatey package manager
RUN Set-ExecutionPolicy Bypass -Scope Process -Force; \
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; \
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
# Install required tools
RUN choco install -y git php composer visualstudio2022buildtools visualstudio2022-workload-vctools
# Create build directories
RUN mkdir -p .build/phar .build/bin
# Download box tool for PHAR creation
RUN Invoke-WebRequest -Uri "https://github.com/box-project/box/releases/download/4.6.6/box.phar" -OutFile ".build/bin/box.phar"
# Download static-php-cli for Windows
RUN Invoke-WebRequest -Uri "https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe" -OutFile ".build/bin/spc.exe"
# Download required PHP extensions
RUN .build/bin/spc.exe download micro \
--for-extensions=ctype,dom,filter,libxml,mbstring,phar,simplexml,sockets,tokenizer,xml,xmlwriter,curl \
--with-php=8.3 \
--prefer-pre-built
# Install UPX for compression
RUN .build/bin/spc.exe install-pkg upx
# Verify environment is ready
RUN .build/bin/spc.exe doctor --auto-fix
# Build the self-executable binary with required extensions
RUN .build/bin/spc.exe build "ctype,dom,filter,libxml,mbstring,phar,simplexml,sockets,tokenizer,xml,xmlwriter,curl" \
--build-micro \
--with-upx-pack
# Default command to display info
CMD ["echo", "PHP Builder image is ready for use"]