Skip to content

Commit a0d8655

Browse files
committed
Experimental windows images
Signed-off-by: apostasie <[email protected]>
1 parent b00f8cd commit a0d8655

File tree

1 file changed

+144
-0
lines changed

1 file changed

+144
-0
lines changed
+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
name: prep
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'release/**'
8+
pull_request:
9+
paths-ignore:
10+
- '**.md'
11+
12+
env:
13+
GO_VERSION: 1.23.x
14+
REGISTRY: ghcr.io
15+
BUSYBOX_VERSION: 5ad83957fa74aafd061afbfb8da14ce3220659a9
16+
REGISTRY_VERSION: v2.8.3
17+
18+
jobs:
19+
build-busybox:
20+
name: busybox
21+
runs-on: ubuntu-24.04
22+
steps:
23+
- id: cache-busybox
24+
uses: actions/cache@v4
25+
with:
26+
path: busybox.exe
27+
key: cache-busybox-${{ env.BUSYBOX_VERSION }}-a
28+
- uses: actions/checkout@v4
29+
if: steps.cache-busybox.outputs.cache-hit != 'true'
30+
with:
31+
repository: rmyorston/busybox-w32
32+
ref: ${{ env.BUSYBOX_VERSION }}
33+
fetch-depth: 1
34+
path: ./src/busybox-w32
35+
- name: ""
36+
if: steps.cache-busybox.outputs.cache-hit != 'true'
37+
run: |
38+
sudo apt-get install gcc-mingw-w64 ncurses-dev
39+
cd ./src/busybox-w32
40+
make mingw64_defconfig
41+
make
42+
cd -
43+
cp ./src/busybox-w32/busybox.exe .
44+
45+
build-registry:
46+
name: registry
47+
runs-on: ubuntu-24.04
48+
steps:
49+
- id: cache-registry
50+
uses: actions/cache@v4
51+
with:
52+
path: build
53+
key: cache-registry-${{ env.REGISTRY_VERSION }}-a
54+
- uses: actions/checkout@v4
55+
if: steps.cache-registry.outputs.cache-hit != 'true'
56+
with:
57+
repository: distribution/distribution
58+
ref: ${{ env.REGISTRY_VERSION }}
59+
path: "${{ github.workspace }}/go/src/github.com/docker/distribution"
60+
fetch-depth: 1
61+
- uses: actions/setup-go@v5
62+
if: steps.cache-registry.outputs.cache-hit != 'true'
63+
with:
64+
go-version: ${{ env.GO_VERSION }}
65+
check-latest: true
66+
cache: true
67+
- name: "build"
68+
# if: steps.cache-registry.outputs.cache-hit != 'true'
69+
run: |
70+
#mkdir ~/build
71+
#VERSION=$(git describe --match 'v[0-9]*' --dirty='.m' --always --tags)
72+
#REVISION=$(git rev-parse HEAD)
73+
#GOOS=windows go build \
74+
# -trimpath \
75+
# -ldflags "-X github.com/docker/distribution/v3/version.version=$VERSION -X github.com/docker/distribution/v3/version.revision=$REVISION -s -w" \
76+
# -o ~/build/registry.exe ./cmd/registry
77+
export GOPATH="${{ github.workspace }}/go"
78+
src="${{ github.workspace }}/go/src/github.com/docker/distribution"
79+
cd "$src"
80+
export GO111MODULE=auto
81+
GOOS=windows make binaries
82+
cd -
83+
mkdir build
84+
cp "$src"/bin/registry build/registry.exe
85+
cp "$src"/cmd/registry/config-dev.yml build
86+
87+
image-busybox:
88+
name: image-busybox
89+
runs-on: windows-2022
90+
needs: build-busybox
91+
defaults:
92+
run:
93+
shell: bash
94+
steps:
95+
- uses: actions/cache/restore@v4
96+
id: cache-busybox
97+
with:
98+
path: busybox.exe
99+
key: cache-busybox-${{ env.BUSYBOX_VERSION }}-a
100+
fail-on-cache-miss: true
101+
- name: "Prep busybox image"
102+
run: |
103+
cat <<EOF > Dockerfile
104+
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
105+
COPY busybox.exe C:/
106+
RUN mkdir C:/tmp && mkdir C:/bin \
107+
&& setx /M PATH "C:/bin;%PATH%" \
108+
&& powershell C:/busybox.exe --list ^|%{$nul = cmd /c mklink C:/bin/$_.exe C:/busybox.exe}
109+
CMD ["sh"]
110+
EOF
111+
- name: "Build image"
112+
run: |
113+
# docker buildx create --name builder --use
114+
docker build --tag busybox-windows -f Dockerfile .
115+
116+
image-registry:
117+
name: image-registry
118+
runs-on: windows-2022
119+
needs: build-registry
120+
defaults:
121+
run:
122+
shell: bash
123+
steps:
124+
- uses: actions/cache/restore@v4
125+
id: cache-registry
126+
with:
127+
path: build
128+
key: cache-registry-${{ env.REGISTRY_VERSION }}-a
129+
fail-on-cache-miss: true
130+
- name: "Prep registry image"
131+
run: |
132+
cat <<EOF > Dockerfile
133+
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
134+
COPY ./build/registry.exe /registry.exe
135+
COPY ./build/config-dev.yml /config.yml
136+
EXPOSE 5000
137+
ENTRYPOINT ["/registry"]
138+
CMD ["serve", "/config.yml"]
139+
EOF
140+
- name: "Build image"
141+
run: |
142+
ls -lA ./build/
143+
# docker buildx create --name builder --use
144+
docker build --tag registry-windows -f Dockerfile .

0 commit comments

Comments
 (0)