.github: add action to build WSC image
This commit is contained in:
parent
b940167a6b
commit
e64a617844
5 changed files with 78 additions and 10 deletions
15
.docker/privnet-entrypoint.ps1
Normal file
15
.docker/privnet-entrypoint.ps1
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#!C:\Program Files\PowerShell\7\pwsh.EXE -File
|
||||||
|
|
||||||
|
$bin = '/usr/bin/neo-go.exe'
|
||||||
|
|
||||||
|
for ( $i = 0; $i -lt $args.count; $i++ ) {
|
||||||
|
if ($args[$i] -eq "node"){
|
||||||
|
Write-Host "=> Try to restore blocks before running node"
|
||||||
|
if (($Env:ACC -ne $null) -and (Test-Path $Env:ACC -PathType Leaf)) {
|
||||||
|
& $bin db restore -p --config-path /config -i $Env:ACC
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
& $bin $args
|
23
.github/workflows/build.yml
vendored
23
.github/workflows/build.yml
vendored
|
@ -40,9 +40,9 @@ jobs:
|
||||||
- name: Build CLI
|
- name: Build CLI
|
||||||
run: make build
|
run: make build
|
||||||
|
|
||||||
build_cli_win:
|
build_cli_wsc:
|
||||||
name: Build CLI (Windows)
|
name: Build CLI (Windows Server Core)
|
||||||
runs-on: windows-2019
|
runs-on: windows-2022
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -66,9 +66,9 @@ jobs:
|
||||||
- name: Build CLI
|
- name: Build CLI
|
||||||
run: make build
|
run: make build
|
||||||
|
|
||||||
build_image:
|
build_image_ubuntu:
|
||||||
needs: build_cli_ubuntu
|
needs: build_cli_ubuntu
|
||||||
name: Build Docker image
|
name: Build Docker image (Ubuntu)
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -78,3 +78,16 @@ jobs:
|
||||||
|
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
run: make image
|
run: make image
|
||||||
|
|
||||||
|
build_image_wsc:
|
||||||
|
needs: build_cli_wsc
|
||||||
|
name: Build Docker image (Windows Server Core)
|
||||||
|
runs-on: windows-2022
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Build Docker image
|
||||||
|
run: make image-wsc
|
||||||
|
|
6
.github/workflows/run_tests.yml
vendored
6
.github/workflows/run_tests.yml
vendored
|
@ -99,9 +99,9 @@ jobs:
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: go test -v -race ./...
|
run: go test -v -race ./...
|
||||||
|
|
||||||
tests_win:
|
tests_wsc:
|
||||||
name: Windows, Go (1.17)
|
name: Windows Server Core, Go (1.17)
|
||||||
runs-on: windows-2019
|
runs-on: windows-2022
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
|
|
36
Dockerfile.wsc
Normal file
36
Dockerfile.wsc
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# Builder image
|
||||||
|
FROM golang:windowsservercore-ltsc2022 as builder
|
||||||
|
|
||||||
|
COPY . /neo-go
|
||||||
|
|
||||||
|
WORKDIR /neo-go
|
||||||
|
|
||||||
|
ARG REPO=repository
|
||||||
|
ARG VERSION=dev
|
||||||
|
|
||||||
|
SHELL ["cmd", "/S", "/C"]
|
||||||
|
RUN go env -w CGO_ENABLED=0
|
||||||
|
ENV GOGC=off
|
||||||
|
|
||||||
|
RUN go build -trimpath -v -o ./bin/neo-go.exe -ldflags="-X %REPO%/pkg/config.Version=%VERSION%" ./cli/main.go
|
||||||
|
|
||||||
|
# Executable image
|
||||||
|
FROM mcr.microsoft.com/windows/servercore:ltsc2022
|
||||||
|
|
||||||
|
ARG VERSION
|
||||||
|
LABEL version=%VERSION%
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
|
||||||
|
COPY --from=builder /neo-go/config /config
|
||||||
|
COPY --from=builder /neo-go/.docker/privnet-entrypoint.ps1 /usr/bin/privnet-entrypoint.ps1
|
||||||
|
COPY --from=builder /neo-go/bin/neo-go.exe /usr/bin/neo-go.exe
|
||||||
|
|
||||||
|
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';", "$ProgressPreference = 'SilentlyContinue';"]
|
||||||
|
|
||||||
|
# Check executable version.
|
||||||
|
RUN /usr/bin/neo-go.exe --version
|
||||||
|
|
||||||
|
ENTRYPOINT ["powershell", "-File", "/usr/bin/privnet-entrypoint.ps1"]
|
||||||
|
|
||||||
|
CMD ["node", "--config-path", "/config", "--privnet"]
|
8
Makefile
8
Makefile
|
@ -18,7 +18,7 @@ IMAGE_REPO=nspccdev/neo-go
|
||||||
|
|
||||||
# All of the targets are phony here because we don't really use make dependency
|
# All of the targets are phony here because we don't really use make dependency
|
||||||
# tracking for files
|
# tracking for files
|
||||||
.PHONY: build deps image image-latest image-push image-push-latest check-version clean-cluster push-tag \
|
.PHONY: build deps image image-wsc image-latest image-push image-push-latest check-version clean-cluster push-tag \
|
||||||
test vet lint fmt cover
|
test vet lint fmt cover
|
||||||
|
|
||||||
build: deps
|
build: deps
|
||||||
|
@ -49,9 +49,13 @@ postinst: install
|
||||||
&& systemctl enable neo-go.service
|
&& systemctl enable neo-go.service
|
||||||
|
|
||||||
image: deps
|
image: deps
|
||||||
@echo "=> Building image"
|
@echo "=> Building image for Ubuntu"
|
||||||
@docker build -t $(IMAGE_REPO):$(VERSION) --build-arg REPO=$(REPO) --build-arg VERSION=$(VERSION) .
|
@docker build -t $(IMAGE_REPO):$(VERSION) --build-arg REPO=$(REPO) --build-arg VERSION=$(VERSION) .
|
||||||
|
|
||||||
|
image-wsc: deps
|
||||||
|
@echo "=> Building image for Windows Server Core"
|
||||||
|
@docker build -f Dockerfile.wsc -t $(IMAGE_REPO):$(VERSION)_WindowsServerCore --build-arg REPO=$(REPO) --build-arg VERSION=$(VERSION) .
|
||||||
|
|
||||||
image-latest: deps
|
image-latest: deps
|
||||||
@echo "=> Building image with 'latest' tag"
|
@echo "=> Building image with 'latest' tag"
|
||||||
@docker build -t $(IMAGE_REPO):latest --build-arg REPO=$(REPO) --build-arg VERSION=$(VERSION) .
|
@docker build -t $(IMAGE_REPO):latest --build-arg REPO=$(REPO) --build-arg VERSION=$(VERSION) .
|
||||||
|
|
Loading…
Reference in a new issue