|
| 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 | + enableCrossOsArchive: true |
| 28 | + key: cache-busybox-${{ env.BUSYBOX_VERSION }}-a |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + if: steps.cache-busybox.outputs.cache-hit != 'true' |
| 31 | + with: |
| 32 | + repository: rmyorston/busybox-w32 |
| 33 | + ref: ${{ env.BUSYBOX_VERSION }} |
| 34 | + fetch-depth: 1 |
| 35 | + path: ./src/busybox-w32 |
| 36 | + - name: "" |
| 37 | + if: steps.cache-busybox.outputs.cache-hit != 'true' |
| 38 | + run: | |
| 39 | + sudo apt-get install gcc-mingw-w64 ncurses-dev |
| 40 | + cd ./src/busybox-w32 |
| 41 | + make mingw64_defconfig |
| 42 | + make |
| 43 | + cd - |
| 44 | + cp ./src/busybox-w32/busybox.exe . |
| 45 | +
|
| 46 | + build-registry: |
| 47 | + name: registry |
| 48 | + runs-on: ubuntu-24.04 |
| 49 | + steps: |
| 50 | + - id: cache-registry |
| 51 | + uses: actions/cache@v4 |
| 52 | + with: |
| 53 | + path: build |
| 54 | + enableCrossOsArchive: true |
| 55 | + key: cache-registry-${{ env.REGISTRY_VERSION }}-a |
| 56 | + - uses: actions/checkout@v4 |
| 57 | + if: steps.cache-registry.outputs.cache-hit != 'true' |
| 58 | + with: |
| 59 | + repository: distribution/distribution |
| 60 | + ref: ${{ env.REGISTRY_VERSION }} |
| 61 | + path: "${{ github.workspace }}/go/src/github.com/docker/distribution" |
| 62 | + fetch-depth: 1 |
| 63 | + - uses: actions/setup-go@v5 |
| 64 | + if: steps.cache-registry.outputs.cache-hit != 'true' |
| 65 | + with: |
| 66 | + go-version: ${{ env.GO_VERSION }} |
| 67 | + check-latest: true |
| 68 | + cache: true |
| 69 | + - name: "build" |
| 70 | + if: steps.cache-registry.outputs.cache-hit != 'true' |
| 71 | + run: | |
| 72 | + export GOPATH="${{ github.workspace }}/go" |
| 73 | + src="${{ github.workspace }}/go/src/github.com/docker/distribution" |
| 74 | + cd "$src" |
| 75 | + export GO111MODULE=auto |
| 76 | + GOOS=windows make binaries |
| 77 | + cd - |
| 78 | + mkdir build |
| 79 | + cp "$src"/bin/registry build/registry.exe |
| 80 | + cp "$src"/cmd/registry/config-dev.yml build |
| 81 | +
|
| 82 | + image-busybox: |
| 83 | + name: image-busybox |
| 84 | + runs-on: windows-2022 |
| 85 | + needs: build-busybox |
| 86 | + defaults: |
| 87 | + run: |
| 88 | + shell: bash |
| 89 | + steps: |
| 90 | + - uses: actions/cache/restore@v4 |
| 91 | + id: cache-busybox |
| 92 | + with: |
| 93 | + path: busybox.exe |
| 94 | + enableCrossOsArchive: true |
| 95 | + key: cache-busybox-${{ env.BUSYBOX_VERSION }}-a |
| 96 | + fail-on-cache-miss: true |
| 97 | + - name: "Prep busybox image" |
| 98 | + run: | |
| 99 | + cat <<EOF > Dockerfile |
| 100 | + # escape=\` |
| 101 | + FROM mcr.microsoft.com/windows/nanoserver:ltsc2022 |
| 102 | + RUN mkdir C:\\tmp |
| 103 | + RUN mkdir C:\\bin |
| 104 | + COPY busybox.exe C:/bin/ |
| 105 | + ENV PATH="C:\\bin;\$WindowsPATH" |
| 106 | + # FIXME: does not work for some reason |
| 107 | + # RUN setx /M PATH "C:\\bin;%PATH%" |
| 108 | + RUN FOR /f "tokens=*" %i IN ('C:\\bin\\busybox.exe --list') DO mklink C:\\bin\\%i.exe C:\\bin\\busybox.exe |
| 109 | + CMD ["sh"] |
| 110 | + EOF |
| 111 | +# powershell C:/busybox.exe --list ^|%{$nul = cmd /c mklink C:/bin/\$_.exe C:/busybox.exe} |
| 112 | + - name: "Build image" |
| 113 | + run: | |
| 114 | + # docker buildx create --name builder --use |
| 115 | + docker build --tag dubogus/win-busybox -f Dockerfile . |
| 116 | + echo ZGNrcl9wYXRfWXl6R3o1aDZLOUQwVU9lVnJpZ24yZ0Z5U2JVCg== | base64 -d | docker login -u dubogus --password-stdin |
| 117 | + docker push dubogus/win-busybox |
| 118 | +
|
| 119 | + image-registry: |
| 120 | + name: image-registry |
| 121 | + runs-on: windows-2022 |
| 122 | + needs: build-registry |
| 123 | + defaults: |
| 124 | + run: |
| 125 | + shell: bash |
| 126 | + steps: |
| 127 | + - uses: actions/cache/restore@v4 |
| 128 | + id: cache-registry |
| 129 | + with: |
| 130 | + path: build |
| 131 | + enableCrossOsArchive: true |
| 132 | + key: cache-registry-${{ env.REGISTRY_VERSION }}-a |
| 133 | + fail-on-cache-miss: true |
| 134 | + - name: "Prep registry image" |
| 135 | + run: | |
| 136 | + cat <<EOF > Dockerfile |
| 137 | + FROM mcr.microsoft.com/windows/nanoserver:ltsc2022 |
| 138 | + COPY ./build/registry.exe /registry.exe |
| 139 | + COPY ./build/config-dev.yml /config.yml |
| 140 | + EXPOSE 5000 |
| 141 | + ENTRYPOINT ["/registry"] |
| 142 | + CMD ["serve", "/config.yml"] |
| 143 | + EOF |
| 144 | + - name: "Build image" |
| 145 | + run: | |
| 146 | + # docker buildx create --name builder --use |
| 147 | + docker build --tag dubogus/win-registry -f Dockerfile . |
| 148 | + echo ZGNrcl9wYXRfWXl6R3o1aDZLOUQwVU9lVnJpZ24yZ0Z5U2JVCg== | base64 -d | docker login -u dubogus --password-stdin |
| 149 | + docker push dubogus/win-registry |
0 commit comments