From f0a4bf616446f44f7d4e9a696f7e5dfb492818b3 Mon Sep 17 00:00:00 2001 From: ljw <84855512@qq.com> Date: Thu, 26 Sep 2024 14:36:15 +0800 Subject: [PATCH] up docker_arm64.yml --- .github/workflows/docker_arm64.yml | 2 +- Dockerfile_arm64 | 36 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 Dockerfile_arm64 diff --git a/.github/workflows/docker_arm64.yml b/.github/workflows/docker_arm64.yml index 72f57b0..b6c62b7 100644 --- a/.github/workflows/docker_arm64.yml +++ b/.github/workflows/docker_arm64.yml @@ -38,4 +38,4 @@ jobs: docker buildx create --use docker buildx build --platform linux/arm64 \ -t lejianwen/rustdesk-api:actiontest-arm64 \ - --push . + --push . -f ./Dockerfile_arm64 diff --git a/Dockerfile_arm64 b/Dockerfile_arm64 new file mode 100644 index 0000000..79f99f4 --- /dev/null +++ b/Dockerfile_arm64 @@ -0,0 +1,36 @@ +FROM arm64v8/golang:1.22-alpine3.19 as builder + +RUN set -eux; \ + apk add --no-cache git gcc build-base sqlite-dev npm nodejs; \ + git clone https://github.com/lejianwen/rustdesk-api-web; \ + git clone https://github.com/lejianwen/rustdesk-api; \ + #先编译后台 + cd rustdesk-api-web; \ + npm install; \ + npm run build; \ + cd ..; \ + mkdir -p rustdesk-api/resources/admin; \ + cp -ar rustdesk-api-web/dist/* rustdesk-api/resources/admin; \ + cd rustdesk-api; \ + go mod tidy; \ + go install github.com/swaggo/swag/cmd/swag@latest; \ + swag init -g cmd/apimain.go --output docs/api --instanceName api --exclude http/controller/admin; \ + swag init -g cmd/apimain.go --output docs/admin --instanceName admin --exclude http/controller/api; \ + go env -w GO111MODULE=on;\ + CGO_LDFLAGS="-static" CGO_ENABLED=1 GOARCH=arm64 go build -ldflags "-s -w" -o ./release/apimain ./cmd/apimain.go; \ + cp -ar resources release/; \ + mkdir -p release/resources/public; \ + cp -ar docs release/; \ + cp -ar conf release/; \ + mkdir -p release/data; \ + mkdir -p release/runtime; + + +FROM arm64v8/alpine +WORKDIR /app +RUN apk add --no-cache tzdata +COPY --from=builder /go/rustdesk-api/release /app/ +VOLUME /app/data + +EXPOSE 21114 +CMD ["./apimain"]