|  | 
|  | 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@v2 | 
|  | 25 | +        with: | 
|  | 26 | +          path: busybox.exe | 
|  | 27 | +          key: cache-busybox-${{ env.BUSYBOX_VERSION }} | 
|  | 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 | +      - if: steps.cache-busybox.outputs.cache-hit != 'true' | 
|  | 36 | +        run: | | 
|  | 37 | +          sudo apt-get install gcc-mingw-w64 ncurses-dev | 
|  | 38 | +          cd ./src/busybox-w32 | 
|  | 39 | +          make mingw64_defconfig | 
|  | 40 | +          make | 
|  | 41 | +          cd - | 
|  | 42 | +          cp ./src/busybox-w32/busybox.exe . | 
|  | 43 | +
 | 
|  | 44 | +  build-registry: | 
|  | 45 | +    name: registry | 
|  | 46 | +    runs-on: ubuntu-24.04 | 
|  | 47 | +    steps: | 
|  | 48 | +      - id: cache-registry | 
|  | 49 | +        uses: actions/cache@v2 | 
|  | 50 | +        with: | 
|  | 51 | +          path: build | 
|  | 52 | +          key: cache-registry-${{ env.REGISTRY_VERSION }} | 
|  | 53 | +      - uses: actions/checkout@v4 | 
|  | 54 | +        if: steps.cache-registry.outputs.cache-hit != 'true' | 
|  | 55 | +        with: | 
|  | 56 | +          repository: distribution/distribution | 
|  | 57 | +          ref: ${{ env.REGISTRY_VERSION }} | 
|  | 58 | +          path: "${{ github.workspace }}/go/src/github.com/docker/distribution" | 
|  | 59 | +          fetch-depth: 1 | 
|  | 60 | +      - uses: actions/setup-go@v5 | 
|  | 61 | +        if: steps.cache-registry.outputs.cache-hit != 'true' | 
|  | 62 | +        with: | 
|  | 63 | +          go-version: ${{ env.GO_VERSION }} | 
|  | 64 | +          check-latest: true | 
|  | 65 | +          cache: true | 
|  | 66 | +      - if: steps.cache-registry.outputs.cache-hit != 'true' | 
|  | 67 | +        run: | | 
|  | 68 | +          #mkdir ~/build | 
|  | 69 | +          #VERSION=$(git describe --match 'v[0-9]*' --dirty='.m' --always --tags) | 
|  | 70 | +          #REVISION=$(git rev-parse HEAD) | 
|  | 71 | +          #GOOS=windows go build \ | 
|  | 72 | +          # -trimpath \ | 
|  | 73 | +          # -ldflags "-X github.com/docker/distribution/v3/version.version=$VERSION -X github.com/docker/distribution/v3/version.revision=$REVISION -s -w" \ | 
|  | 74 | +          # -o ~/build/registry ./cmd/registry | 
|  | 75 | +          export GOPATH="${{ github.workspace }}/go" | 
|  | 76 | +          src="${{ github.workspace }}/go/src/github.com/docker/distribution" | 
|  | 77 | +          cd "$src" | 
|  | 78 | +          export GO111MODULE=auto | 
|  | 79 | +          make binaries | 
|  | 80 | +          cd - | 
|  | 81 | +          mkdir build | 
|  | 82 | +          cp "$src"/bin/registry build | 
|  | 83 | +          cp "$src"/cmd/registry/config-dev.yml build | 
|  | 84 | +
 | 
|  | 85 | +  image-busybox: | 
|  | 86 | +    name: image-busybox | 
|  | 87 | +    runs-on: windows-2022 | 
|  | 88 | +    needs: build-busybox | 
|  | 89 | +    defaults: | 
|  | 90 | +      run: | 
|  | 91 | +        shell: bash | 
|  | 92 | +    steps: | 
|  | 93 | +      - id: cache-busybox | 
|  | 94 | +        uses: actions/cache@v2 | 
|  | 95 | +        with: | 
|  | 96 | +          path: busybox.exe | 
|  | 97 | +          key: cache-busybox-${{ env.BUSYBOX_VERSION }} | 
|  | 98 | +      - name: "Prep busybox image" | 
|  | 99 | +        run: | | 
|  | 100 | +          cat <<EOF > Dockerfile | 
|  | 101 | +          FROM mcr.microsoft.com/windows/nanoserver:ltsc2022 | 
|  | 102 | +          COPY busybox.exe C:\ | 
|  | 103 | +          RUN mkdir C:\tmp && mkdir C:\bin \ | 
|  | 104 | +            && setx /M PATH "C:\bin;%PATH%" \ | 
|  | 105 | +            && powershell C:\busybox.exe --list ^|%{$nul = cmd /c mklink C:\bin\$_.exe C:\busybox.exe} | 
|  | 106 | +          CMD ["sh"] | 
|  | 107 | +          EOF | 
|  | 108 | +      - name: "Build image" | 
|  | 109 | +        run: | | 
|  | 110 | +          # docker buildx create --name builder --use | 
|  | 111 | +          docker build --tag busybox-windows -f Dockerfile . | 
|  | 112 | +
 | 
|  | 113 | +  image-registry: | 
|  | 114 | +    name: image-registry | 
|  | 115 | +    runs-on: windows-2022 | 
|  | 116 | +    needs: build-registry | 
|  | 117 | +    defaults: | 
|  | 118 | +      run: | 
|  | 119 | +        shell: bash | 
|  | 120 | +    steps: | 
|  | 121 | +      - id: cache-registry | 
|  | 122 | +        uses: actions/cache@v2 | 
|  | 123 | +        with: | 
|  | 124 | +          path: build | 
|  | 125 | +          key: cache-registry-${{ env.REGISTRY_VERSION }} | 
|  | 126 | +      - name: "Prep registry image" | 
|  | 127 | +        run: | | 
|  | 128 | +          cat <<EOF > Dockerfile | 
|  | 129 | +          FROM mcr.microsoft.com/windows/nanoserver:ltsc2022 | 
|  | 130 | +          COPY ./build/registry /registry | 
|  | 131 | +          COPY ./build/config-dev.yml /config.yml | 
|  | 132 | +          EXPOSE 5000 | 
|  | 133 | +          ENTRYPOINT ["/registry"] | 
|  | 134 | +          CMD ["serve", "/config.yml"] | 
|  | 135 | +          EOF | 
|  | 136 | +      - name: "Build image" | 
|  | 137 | +        run: | | 
|  | 138 | +          # docker buildx create --name builder --use | 
|  | 139 | +          docker build --tag registry-windows -f Dockerfile . | 
0 commit comments