Skip to content

Commit

Permalink
Experimental windows images
Browse files Browse the repository at this point in the history
Signed-off-by: apostasie <spam_blackhole@farcloser.world>
  • Loading branch information
apostasie committed Nov 2, 2024
1 parent b00f8cd commit 492f7d0
Showing 1 changed file with 142 additions and 0 deletions.
142 changes: 142 additions & 0 deletions .github/workflows/test-images-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
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@v2
with:
path: busybox.exe
key: cache-busybox-${{ env.BUSYBOX_VERSION }}
- uses: actions/checkout@v4
#if: steps.cache-busybox.outputs.cache-hit != 'true'

Check warning on line 29 in .github/workflows/test-images-build.yml

View workflow job for this annotation

GitHub Actions / yaml | shell | imports order

29:10 [comments] missing starting space in comment
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'

Check warning on line 36 in .github/workflows/test-images-build.yml

View workflow job for this annotation

GitHub Actions / yaml | shell | imports order

36:10 [comments] missing starting space in comment
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@v2
with:
path: build
key: cache-registry-${{ env.REGISTRY_VERSION }}
- uses: actions/checkout@v4
#if: steps.cache-registry.outputs.cache-hit != 'true'

Check warning on line 55 in .github/workflows/test-images-build.yml

View workflow job for this annotation

GitHub Actions / yaml | shell | imports order

55:10 [comments] missing starting space in comment
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'

Check warning on line 62 in .github/workflows/test-images-build.yml

View workflow job for this annotation

GitHub Actions / yaml | shell | imports order

62:10 [comments] missing starting space in comment
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true
- name: "build"
# if: steps.cache-registry.outputs.cache-hit != 'true'
run: |
#mkdir ~/build
#VERSION=$(git describe --match 'v[0-9]*' --dirty='.m' --always --tags)
#REVISION=$(git rev-parse HEAD)
#GOOS=windows go build \
# -trimpath \
# -ldflags "-X github.com/docker/distribution/v3/version.version=$VERSION -X github.com/docker/distribution/v3/version.revision=$REVISION -s -w" \
# -o ~/build/registry.exe ./cmd/registry
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:
- id: cache-busybox
uses: actions/cache@v2
with:
path: busybox.exe
key: cache-busybox-${{ env.BUSYBOX_VERSION }}
- name: "Prep busybox image"
run: |
cat <<EOF > Dockerfile
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
COPY busybox.exe C:/
RUN mkdir C:/tmp && mkdir C:/bin \
&& setx /M PATH "C:/bin;%PATH%" \
&& powershell C:/busybox.exe --list ^|%{$nul = cmd /c mklink C:/bin/$_.exe C:/busybox.exe}
CMD ["sh"]
EOF
- name: "Build image"
run: |
# docker buildx create --name builder --use
docker build --tag busybox-windows -f Dockerfile .
image-registry:
name: image-registry
runs-on: windows-2022
needs: build-registry
defaults:
run:
shell: bash
steps:
- id: cache-registry
uses: actions/cache@v2
with:
path: build
key: cache-registry-${{ env.REGISTRY_VERSION }}
- 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: |
ls -lA ./build/
# docker buildx create --name builder --use
docker build --tag registry-windows -f Dockerfile .

0 comments on commit 492f7d0

Please sign in to comment.