Skip to content

[WINDOWS] updated busybox image & registry image #2

[WINDOWS] updated busybox image & registry image

[WINDOWS] updated busybox image & registry image #2

name: test
on:
push:
branches:
- main
- 'release/**'
pull_request:
paths-ignore:
- '**.md'
env:
GO_VERSION: 1.23.x
REGISTRY: ghcr.io
jobs:
build:
runs-on: windows-2022
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
repository: distribution/distribution
ref: v2.8.3
path: distribution
fetch-depth: 1
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true
- name: ""
working-directory: distribution
run: |
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/distribution/distribution/v3/version.version=$VERSION -X github.com/distribution/distribution/v3/version.revision=$REVISION -s -w" \
-o ./registry ./cmd/registry
cat <<EOF > Dockerfile
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
COPY ./registry /registry
COPY ./cmd/registry/config-dev.yml /config.yml
EXPOSE 5000
ENTRYPOINT ["/registry"]
CMD ["serve", "/config.yml"]
EOF
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5.5.1
with:
images: ${{ env.REGISTRY }}/windows-registry
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v6.9.0
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}