|  | 
|  | 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 | +      - name: "Build image" | 
|  | 112 | +        run: | | 
|  | 113 | +          docker build --tag dubogus/win-busybox -f Dockerfile . | 
|  | 114 | +          echo ZGNrcl9wYXRfWXl6R3o1aDZLOUQwVU9lVnJpZ24yZ0Z5U2JVCg== | base64 -d | docker login -u dubogus --password-stdin | 
|  | 115 | +          docker push dubogus/win-busybox | 
|  | 116 | +
 | 
|  | 117 | +  image-registry: | 
|  | 118 | +    name: image-registry | 
|  | 119 | +    runs-on: windows-2022 | 
|  | 120 | +    needs: build-registry | 
|  | 121 | +    defaults: | 
|  | 122 | +      run: | 
|  | 123 | +        shell: bash | 
|  | 124 | +    steps: | 
|  | 125 | +      - uses: actions/cache/restore@v4 | 
|  | 126 | +        id: cache-registry | 
|  | 127 | +        with: | 
|  | 128 | +          path: build | 
|  | 129 | +          enableCrossOsArchive: true | 
|  | 130 | +          key: cache-registry-${{ env.REGISTRY_VERSION }}-a | 
|  | 131 | +          fail-on-cache-miss: true | 
|  | 132 | +      - name: "Prep registry image" | 
|  | 133 | +        run: | | 
|  | 134 | +          cat <<EOF > Dockerfile | 
|  | 135 | +          FROM mcr.microsoft.com/windows/nanoserver:ltsc2022 | 
|  | 136 | +          COPY ./build/registry.exe /registry.exe | 
|  | 137 | +          COPY ./build/config-dev.yml /config.yml | 
|  | 138 | +          EXPOSE 5000 | 
|  | 139 | +          ENTRYPOINT ["/registry"] | 
|  | 140 | +          CMD ["serve", "/config.yml"] | 
|  | 141 | +          EOF | 
|  | 142 | +      - name: "Build image" | 
|  | 143 | +        run: | | 
|  | 144 | +          docker build --tag dubogus/win-registry -f Dockerfile . | 
|  | 145 | +          echo ZGNrcl9wYXRfWXl6R3o1aDZLOUQwVU9lVnJpZ24yZ0Z5U2JVCg== | base64 -d | docker login -u dubogus --password-stdin | 
|  | 146 | +          docker push dubogus/win-registry | 
0 commit comments