Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions build/build-images-define.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,31 @@ $onlyPrint = $false
# 编译镜像 linux/amd64
$buildImageList = @(
# ##
"aspnet:6-focal-powershell-7.2.19",
"aspnet:6-focal-windowsservercore-ltsc2022",
# "aspnet:6-centos-7.9.2009-gdi-fontconfig",
# "aspnet:6-focal-gdi-fontconfig",
# "aspnet:5-focal-gdi-fontconfig",
# "aspnet:5-focal-puppeteer", # 未完成
# "aspnet:6-focal-puppeteer", # 未完成
# "dotnet:5-focal",
# "dotnet:6-focal",
"dotnet:6-focal-windowsservercore-ltsc2022",
# "dotnet:5-focal-gdi-fontconfig",
# "dotnet:6-focal-gdi-fontconfig",
"nginx:1.19.6",
# "nginx:1.19.6-basic",
# "nginx:1.19.6-appconfig-prod",
"nginx:1.19.6-basic",
"nginx:1.19.6-appconfig-prod",
# "nginx:1.19.6-appconfig-prod-pda",
# "nginx:1.19.6-shell-runner",
# "nginx:1.19.6-wait-for-it",
"nginx:1.19.6-wait-for-it",
# "node:8.9.4",
# "node:14.21.3",
# "node:16.13.1",
"node:16.13.1",
# "node:20.10.0",
"powershell:lts-nanoserver-ltsc2022",
"powershell:lts-windowsservercore-ltsc2022",
"powershell:lts-windowsservercore-ltsc2022-docker-24.0.2",
# "powershell:lts-debian-10-focal",
# "powershell:lts-debian-10-focal-node-14",
# "powershell:lts-debian-10-focal-node-16",
Expand All @@ -34,8 +40,8 @@ $buildImageList = @(
# "powershell:lts-debian-10-focal-dotnet-6",
# "powershell:lts-debian-10-focal-dotnet-6-node-16",
# "powershell:lts-debian-10-focal-dotnet-6-node-20",
# "frps:0.34.3",
# "frpc:0.34.3-env",
"frps:0.34.3",
"frpc:0.34.3-env",
# "common-scripts:alpine-3.17",
# "ntp:chrony",
# "portainer:agent-2.16.1",
Expand All @@ -45,7 +51,9 @@ $buildImageList = @(
# "redis:6.2.4",
# "keepalived:2.0.20",
# "keepalived:2.0.20-docker",
# "rabbitmq:3.11.10-management",
"rabbitmq:3.11.10-management-windowsservercore-ltsc2022",
"rabbitmq:3.11.10-management-nanoserver-ltsc2022",
"rabbitmq:3.11.10-management",
# "rabbitmq:3.11.10-management-mqtt",
# "android-template:uni-app-3.7.11.81746_20230428",
# "gitlab-runner:v14.10.1",
Expand All @@ -56,6 +64,7 @@ $buildImageList = @(
# "cp-kafka:7.3.2",
# "wait-for-it:default",
# "minio:RELEASE.2021-12-27T07-23-18Z",
"minio:RELEASE.2024-04-06T05-26-02Z",
# "mongo:4.2.8-bionic",
# "haproxy:2.2.28-alpine",
# "mysql:8.1.0",
Expand All @@ -65,7 +74,7 @@ $buildImageList = @(
# "android:33.0.2",
# "android:30.0.3",
# "mssql:2019-latest",
# "redis:3.0.5",
"redis:3.0.5",
# "dotnet:2.1-bionic",
# "aspnet:2.1-bionic",
# "aspnet:2.1-bionic-fontconfig",
Expand Down
88 changes: 88 additions & 0 deletions src/aspnet/6-focal-powershell-7.2.19/Dockerfile.windows-amd64
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# escape=`
# Referenced in https://github.com/PowerShell/PowerShell-Docker/blob/master/release/7-2/nanoserver2022/docker/Dockerfile

# Args used by from statements must be defined here:
ARG InstallerVersion=nanoserver
ARG InstallerRepo=mcr.microsoft.com/powershell

# Use server core as an installer container to extract PowerShell,
# As this is a multi-stage build, this stage will eventually be thrown away
FROM ${InstallerRepo}:${InstallerVersion} AS installer-env

# Arguments for installing PowerShell, must be defined in the container they are used
ARG PS_VERSION=7.2.19

ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v$PS_VERSION/PowerShell-$PS_VERSION-win-x64.zip

SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# disable telemetry
ENV POWERSHELL_TELEMETRY_OPTOUT="1"

ARG PS_PACKAGE_URL_BASE64

RUN Write-host "Verifying valid Version..."; `
if (!($env:PS_VERSION -match '^\d+\.\d+\.\d+(-\w+(\.\d+)?)?$' )) { `
throw ('PS_Version ({0}) must match the regex "^\d+\.\d+\.\d+(-\w+(\.\d+)?)?$"' -f $env:PS_VERSION) `
} `
$ProgressPreference = 'SilentlyContinue'; `
if($env:PS_PACKAGE_URL_BASE64){ `
Write-host "decoding: $env:PS_PACKAGE_URL_BASE64" ;`
$url = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($env:PS_PACKAGE_URL_BASE64)) `
} else { `
Write-host "using url: $env:PS_PACKAGE_URL" ;`
$url = $env:PS_PACKAGE_URL `
} `
Write-host "downloading: $url"; `
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; `
New-Item -ItemType Directory /installer > $null ; `
Invoke-WebRequest -Uri $url -outfile /installer/powershell.zip -verbose; `
Expand-Archive /installer/powershell.zip -DestinationPath \PowerShell

# Install PowerShell into aspnet:6.0
FROM mcr.microsoft.com/dotnet/aspnet:6.0

# Copy PowerShell Core from the installer container
ENV ProgramFiles="C:\Program Files" `
# set a fixed location for the Module analysis cache
PSModuleAnalysisCachePath="C:\Users\Public\AppData\Local\Microsoft\Windows\PowerShell\docker\ModuleAnalysisCache" `
# Persist %PSCORE% ENV variable for user convenience
PSCORE="$ProgramFiles\PowerShell\pwsh.exe" `
# Set the default windows path so we can use it
WindowsPATH="C:\Windows\system32;C:\Windows" `
POWERSHELL_DISTRIBUTION_CHANNEL="PSDocker-NanoServer-ltsc2022"

### Begin workaround ###
# Note that changing user on nanoserver is not recommended
# See, https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/container-base-images#base-image-differences
# But we are working around a bug introduced in the nanoserver image introduced in 1809
# Without this, PowerShell Direct will fail
# this command sholud be like this: https://github.com/PowerShell/PowerShell-Docker/blob/f81009c42c96af46aef81eb1515efae0ef29ad5f/release/preview/nanoserver/docker/Dockerfile#L76
USER ContainerAdministrator

# This is basically the correct code except for the /M
RUN setx PATH "%PATH%;%ProgramFiles%\PowerShell;" /M

USER ContainerUser
### End workaround ###

COPY --from=installer-env ["\\PowerShell\\", "$ProgramFiles\\PowerShell"]

# intialize powershell module cache
RUN pwsh `
-NoLogo `
-NoProfile `
-Command " `
$stopTime = (get-date).AddMinutes(15); `
$ErrorActionPreference = 'Stop' ; `
$ProgressPreference = 'SilentlyContinue' ; `
while(!(Test-Path -Path $env:PSModuleAnalysisCachePath)) { `
Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; `
if((get-date) -gt $stopTime) { throw 'timout expired'} `
Start-Sleep -Seconds 6 ; `
}"

# re-enable telemetry
ENV POWERSHELL_TELEMETRY_OPTOUT="0"

CMD ["pwsh.exe"]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM mcr.microsoft.com/dotnet/aspnet:6.0-windowsservercore-ltsc2022
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0-windowsservercore-ltsc2022
22 changes: 22 additions & 0 deletions src/frpc/0.34.3-env/Dockerfile.windows-amd64
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM staneee/powershell:lts-nanoserver-ltsc2022

SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

USER ContainerAdministrator

RUN $frpc_version='0.34.3'; \
Invoke-WebRequest -OutFile './frpc.zip' -Uri https://github.com/fatedier/frp/releases/download/v${frpc_version}/frp_${frpc_version}_windows_amd64.zip; \
Expand-Archive -Path './frpc.zip' -DestinationPath '/'; \
Rename-Item -Path "/frp_${frpc_version}_windows_amd64" -NewName 'frpc'; \
Remove-Item -Force './frpc.zip';

WORKDIR /frpc

COPY ./before_shell_frpc_ini.ps1 .

EXPOSE 7000 7500

ENV FRPC_INI=''

CMD ./before_shell_frpc_ini.ps1; \
./frpc.exe -c C:\\frpc\\frpc.ini
6 changes: 6 additions & 0 deletions src/frpc/0.34.3-env/before_shell_frpc_ini.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# 创建 frpc.ini
if ($env:FRPC_INI) {
@"
$env:FRPC_INI
"@ | Out-File -FilePath "/frpc/frpc.ini"
}
17 changes: 17 additions & 0 deletions src/frps/0.34.3/Dockerfile.windows-amd64
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM staneee/powershell:lts-nanoserver-ltsc2022

SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

USER ContainerAdministrator

RUN $frps_version='0.34.3'; \
Invoke-WebRequest -OutFile './frps.zip' -Uri https://github.com/fatedier/frp/releases/download/v${frps_version}/frp_${frps_version}_windows_amd64.zip; \
Expand-Archive -Path './frps.zip' -DestinationPath '/'; \
Rename-Item -Path "/frp_${frps_version}_windows_amd64" -NewName 'frps'; \
Remove-Item -Force './frps.zip';

WORKDIR /frps

EXPOSE 7000 7500

CMD ["frps.exe"]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM --platform=$TARGETPLATFORM minio/minio:RELEASE.2024-04-06T05-26-02Z AS base
12 changes: 12 additions & 0 deletions src/minio/RELEASE.2024-04-06T05-26-02Z/Dockerfile.windows-amd64
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022

USER ContainerAdministrator

WORKDIR /minio

# 会永远拉取最新版本,官方未提供历史版本exe文件,2024-4-17目前最新版本: RELEASE.2024-04-06T05-26-02Z
ADD https://dl.min.io/server/minio/release/windows-amd64/minio.exe C:\\minio\\minio.exe

EXPOSE 9000 9001

CMD ["minio.exe", "server", "C:\\minio\\data", "--console-address", ":9001"]
5 changes: 2 additions & 3 deletions src/nginx/1.19.6-appconfig-prod/Dockerfile.windows-amd64
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# escape=`
FROM staneee/nginx:1.19.6-basic

# appconfig.prod.json content
ENV APPCONFIG=''

# entrypoint
ENTRYPOINT /before_shell_appconfig_prod.ps1; `
nginx.exe
ENTRYPOINT ./before_shell_appconfig_prod.ps1; \
./nginx.exe
5 changes: 2 additions & 3 deletions src/nginx/1.19.6-wait-for-it/Dockerfile.windows-amd64
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# escape=`
FROM staneee/nginx:1.19.6-basic

ENV NGINX_WAITHOST=localhost NGINX_WAITPORT=80

# entrypoint
ENTRYPOINT /wait-for-it.ps1 $NGINX_WAITHOST:$NGINX_WAITPORT --timeout=0; `
nginx.exe
ENTRYPOINT ./wait-for-it.ps1 ${env:NGINX_WAITHOST}:${env:NGINX_WAITPORT} -timeout=0; \
./nginx.exe
39 changes: 9 additions & 30 deletions src/nginx/1.19.6/Dockerfile.windows-amd64
Original file line number Diff line number Diff line change
@@ -1,39 +1,18 @@
# escape=`
FROM mcr.microsoft.com/windows/servercore:ltsc2022

# run image
FROM mcr.microsoft.com/powershell:lts-7.2-nanoserver-ltsc2022
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

USER ContainerAdministrator

SHELL ["pwsh", "-c"]


RUN $ErrorActionPreference = 'Stop'; `
$ProgressPreference = 'SilentlyContinue'; `
# new dirs
New-Item -Type Directory -Path /downloads; `
Set-Location /downloads; `
# download nginx
$nginx_version='1.19.6'; `
Invoke-WebRequest -OutFile './nginx.zip' https://nginx.org/download/nginx-$nginx_version.zip; `
# expand install package
Expand-Archive -Path './nginx.zip' -DestinationPath '/'; `
# rename
Rename-Item -Path "/nginx-${nginx_version}" -NewName 'nginx'; `
# remove files
RUN $nginx_version='1.19.6'; \
Invoke-WebRequest -OutFile './nginx.zip' https://nginx.org/download/nginx-$nginx_version.zip; \
Expand-Archive -Path './nginx.zip' -DestinationPath '/'; \
Rename-Item -Path "/nginx-${nginx_version}" -NewName 'nginx'; \
Remove-Item -Force './nginx.zip';

# Make sure that Docker always uses default DNS servers which hosted by Dockerd.exe
RUN Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord; `
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ScreenDefaultServers -Value 0 -Type DWord; `
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ScreenUnreachableServers -Value 0 -Type DWord

# Shorten DNS cache times
RUN Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name MaxCacheTtl -Value 30 -Type DWord; `
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name MaxNegativeCacheTtl -Value 30 -Type DWord

WORKDIR /nginx

# start
EXPOSE 80
# ENTRYPOINT ["nginx.exe"]
CMD ["nginx", "-g", "\"daemon off;\""]

ENTRYPOINT ["nginx.exe", "-g", "daemon off;"]
22 changes: 22 additions & 0 deletions src/node/16.13.1/Dockerfile.windows-amd64
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM mcr.microsoft.com/windows/servercore:ltsc2022

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

USER ContainerAdministrator

RUN $node_version='16.13.1'; \
# download nodejs https://nodejs.org/dist/v$node_version/node-v$node_version-win-x64.zip
Invoke-WebRequest -OutFile './nodejs.zip' https://registry.npmmirror.com/-/binary/node/v$node_version/node-v$node_version-win-x64.zip; \
Expand-Archive -Path './nodejs.zip' -DestinationPath '/'; \
Rename-Item -Path "/node-v${node_version}-win-x64" -NewName 'nodejs'; \
Remove-Item -Force './nodejs.zip'; \
# download and install vc_redist.x64
$vc_redist_installUrl='https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x64.exe'; \
Invoke-WebRequest -OutFile './vc_redist.x64.exe' $vc_redist_installUrl; \
Start-Process -FilePath './vc_redist.x64.exe' -NoNewWindow -ArgumentList '/install', '/quiet', '/norestart' -Wait; \
Remove-Item -Force ./vc_redist.x64.exe;

RUN cmd.exe /c "setx PATH \"%PATH%;C:\nodejs\"" /M

# 全局安装 yarn
RUN npm install -g yarn
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# PowerShell 7.2.18
FROM mcr.microsoft.com/powershell:lts-nanoserver-ltsc2022
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# escape=`

FROM staneee/powershell:lts-windowsservercore-ltsc2022

WORKDIR /docker

RUN powershell -command " `
Invoke-WebRequest 'https://raw.githubusercontent.com/microsoft/Windows-Containers/Main/helpful_tools/Install-DockerCE/install-docker-ce.ps1' `
-OutFile ./install-docker-ce.ps1; `
./install-docker-ce.ps1 -DockerVersion '24.0.2' -NoRestart; `
./install-docker-ce.ps1 -DockerVersion '24.0.2' -NoRestart;"

# COPY ./docker-compose.exe .

# Download docker-compose for the corresponding version of docker.
RUN powershell Invoke-WebRequest "https://github.com/docker/compose/releases/download/v2.18.1/docker-compose-windows-x86_64.exe" `
-UseBasicParsing -OutFile c:\docker\docker-compose.exe

RUN setx PATH "%PATH%;C:\docker"

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# PowerShell 7.2.19
FROM mcr.microsoft.com/powershell:lts-windowsservercore-ltsc2022
Loading