-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to create docker image with windows registry
Signed-off-by: Joao Pereira <joaod@vmware.com>
- Loading branch information
1 parent
d903607
commit 1ff5946
Showing
5 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Registry in Windows container build | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: windows-2022 | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Building image | ||
shell: pwsh | ||
run: | | ||
cd hack\windows-registry | ||
.\build.ps1 | ||
.\push.ps1 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM golang:1.17-windowsservercore-ltsc2022 as build | ||
|
||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] | ||
|
||
ENV DOCKER_BUILDTAGS include_oss include_gcs | ||
ENV DISTRIBUTION_VERSION v2.8.0 | ||
ENV GO111MODULE off | ||
|
||
RUN mkdir src\github.com\docker ; \ | ||
cd src\github.com\docker ; \ | ||
git clone -q https://github.com/docker/distribution ; \ | ||
cd distribution ; \ | ||
git checkout -q $env:DISTRIBUTION_VERSION ; \ | ||
go build -o registry.exe cmd/registry/main.go | ||
|
||
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022 | ||
|
||
COPY --from=build /go/src/github.com/docker/distribution/registry.exe /registry.exe | ||
COPY config.yml /config/config.yml | ||
|
||
EXPOSE 5000 | ||
|
||
ENTRYPOINT ["\\registry.exe"] | ||
CMD ["serve", "/config/config.yml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Write-Host Building registry binary and image | ||
$version=$(select-string -Path Dockerfile -Pattern "ENV DISTRIBUTION_VERSION").ToString().split()[-1].SubString(1) | ||
docker build -t ghcr.io/tanzu-vmware/vmware-tanzu/carvel-imgpkg/registry-windows . | ||
docker tag ghcr.io/tanzu-vmware/vmware-tanzu/carvel-imgpkg/registry-windows:latest ghcr.io/tanzu-vmware/vmware-tanzu/carvel-imgpkg/registry-windows:$version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: 0.1 | ||
log: | ||
fields: | ||
service: registry | ||
storage: | ||
cache: | ||
blobdescriptor: inmemory | ||
filesystem: | ||
rootdirectory: /registry | ||
http: | ||
addr: :5000 | ||
headers: | ||
X-Content-Type-Options: [nosniff] | ||
health: | ||
storagedriver: | ||
enabled: true | ||
interval: 10s | ||
threshold: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
$version=$(select-string -Path Dockerfile -Pattern "ENV DISTRIBUTION_VERSION").ToString().split()[-1].SubString(1) | ||
docker tag ghcr.io/tanzu-vmware/vmware-tanzu/carvel-imgpkg/registry-windows:$version ghcr.io/tanzu-vmware/vmware-tanzu/carvel-imgpkg/registry-windows:$version-2022 | ||
docker push ghcr.io/tanzu-vmware/vmware-tanzu/carvel-imgpkg/registry-windows:$version-2022 |