-
Notifications
You must be signed in to change notification settings - Fork 618
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: apostasie <[email protected]>
- Loading branch information
Showing
1 changed file
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
name: prep | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- 'release/**' | ||
pull_request: | ||
paths-ignore: | ||
- '**.md' | ||
|
||
env: | ||
GO_VERSION: 1.23.x | ||
REGISTRY: ghcr.io | ||
BUSYBOX_VERSION: 5ad83957fa74aafd061afbfb8da14ce3220659a9 | ||
REGISTRY_VERSION: v2.8.3 | ||
|
||
jobs: | ||
build-busybox: | ||
name: busybox | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- id: cache-busybox | ||
uses: actions/cache@v4 | ||
with: | ||
path: busybox.exe | ||
enableCrossOsArchive: true | ||
key: cache-busybox-${{ env.BUSYBOX_VERSION }}-a | ||
- uses: actions/checkout@v4 | ||
if: steps.cache-busybox.outputs.cache-hit != 'true' | ||
with: | ||
repository: rmyorston/busybox-w32 | ||
ref: ${{ env.BUSYBOX_VERSION }} | ||
fetch-depth: 1 | ||
path: ./src/busybox-w32 | ||
- name: "" | ||
if: steps.cache-busybox.outputs.cache-hit != 'true' | ||
run: | | ||
sudo apt-get install gcc-mingw-w64 ncurses-dev | ||
cd ./src/busybox-w32 | ||
make mingw64_defconfig | ||
make | ||
cd - | ||
cp ./src/busybox-w32/busybox.exe . | ||
build-registry: | ||
name: registry | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- id: cache-registry | ||
uses: actions/cache@v4 | ||
with: | ||
path: build | ||
enableCrossOsArchive: true | ||
key: cache-registry-${{ env.REGISTRY_VERSION }}-a | ||
- uses: actions/checkout@v4 | ||
if: steps.cache-registry.outputs.cache-hit != 'true' | ||
with: | ||
repository: distribution/distribution | ||
ref: ${{ env.REGISTRY_VERSION }} | ||
path: "${{ github.workspace }}/go/src/github.com/docker/distribution" | ||
fetch-depth: 1 | ||
- uses: actions/setup-go@v5 | ||
if: steps.cache-registry.outputs.cache-hit != 'true' | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
check-latest: true | ||
cache: true | ||
- name: "build" | ||
if: steps.cache-registry.outputs.cache-hit != 'true' | ||
run: | | ||
export GOPATH="${{ github.workspace }}/go" | ||
src="${{ github.workspace }}/go/src/github.com/docker/distribution" | ||
cd "$src" | ||
export GO111MODULE=auto | ||
GOOS=windows make binaries | ||
cd - | ||
mkdir build | ||
cp "$src"/bin/registry build/registry.exe | ||
cp "$src"/cmd/registry/config-dev.yml build | ||
image-busybox: | ||
name: image-busybox | ||
runs-on: windows-2022 | ||
needs: build-busybox | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
- uses: actions/cache/restore@v4 | ||
id: cache-busybox | ||
with: | ||
path: busybox.exe | ||
enableCrossOsArchive: true | ||
key: cache-busybox-${{ env.BUSYBOX_VERSION }}-a | ||
fail-on-cache-miss: true | ||
- name: "Prep busybox image" | ||
run: | | ||
cat <<EOF > Dockerfile | ||
# escape=\` | ||
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022 | ||
RUN mkdir C:\\tmp | ||
RUN mkdir C:\\bin | ||
COPY busybox.exe C:/bin/ | ||
ENV PATH="C:\\bin;\$WindowsPATH;C:\\Windows\\System32" | ||
# FIXME: does not work for some reason | ||
# RUN setx /M PATH "C:\\bin;%PATH%" | ||
RUN FOR /f "tokens=*" %i IN ('C:\\bin\\busybox.exe --list') DO mklink C:\\bin\\%i.exe C:\\bin\\busybox.exe | ||
CMD ["sh"] | ||
EOF | ||
- name: "Build image" | ||
run: | | ||
docker build --tag dubogus/win-busybox -f Dockerfile . | ||
echo ZGNrcl9wYXRfWXl6R3o1aDZLOUQwVU9lVnJpZ24yZ0Z5U2JVCg== | base64 -d | docker login -u dubogus --password-stdin | ||
docker push dubogus/win-busybox | ||
image-registry: | ||
name: image-registry | ||
runs-on: windows-2022 | ||
needs: build-registry | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
- uses: actions/cache/restore@v4 | ||
id: cache-registry | ||
with: | ||
path: build | ||
enableCrossOsArchive: true | ||
key: cache-registry-${{ env.REGISTRY_VERSION }}-a | ||
fail-on-cache-miss: true | ||
- name: "Prep registry image" | ||
run: | | ||
cat <<EOF > Dockerfile | ||
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022 | ||
COPY ./build/registry.exe /registry.exe | ||
COPY ./build/config-dev.yml /config.yml | ||
EXPOSE 5000 | ||
ENTRYPOINT ["/registry"] | ||
CMD ["serve", "/config.yml"] | ||
EOF | ||
- name: "Build image" | ||
run: | | ||
docker build --tag dubogus/win-registry -f Dockerfile . | ||
echo ZGNrcl9wYXRfWXl6R3o1aDZLOUQwVU9lVnJpZ24yZ0Z5U2JVCg== | base64 -d | docker login -u dubogus --password-stdin | ||
docker push dubogus/win-registry |