mirror of
https://github.com/dnote/dnote
synced 2026-03-14 14:35:50 +01:00
Cross-platform build for server (#682)
This commit is contained in:
parent
61162e2add
commit
b141b677bb
3 changed files with 17 additions and 23 deletions
11
.github/workflows/release-server.yml
vendored
11
.github/workflows/release-server.yml
vendored
|
|
@ -78,14 +78,3 @@ jobs:
|
|||
--title="$TAG" \
|
||||
--notes="Please see the [CHANGELOG](https://github.com/dnote/dnote/blob/master/CHANGELOG.md)" \
|
||||
--draft
|
||||
|
||||
- name: Push to Docker Hub
|
||||
env:
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
|
||||
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||
docker push dnote/dnote:${VERSION}
|
||||
docker push dnote/dnote:latest
|
||||
|
|
|
|||
|
|
@ -1,13 +1,8 @@
|
|||
FROM alpine:latest
|
||||
FROM busybox:glibc
|
||||
|
||||
ARG tarballName
|
||||
RUN test -n "$tarballName"
|
||||
|
||||
# add dependency to execute a golang binary with dynamical linking.
|
||||
RUN apk add --no-cache \
|
||||
libc6-compat \
|
||||
gcompat
|
||||
|
||||
WORKDIR dnote
|
||||
|
||||
COPY "$tarballName" .
|
||||
|
|
|
|||
|
|
@ -29,23 +29,30 @@ build() {
|
|||
platform=$1
|
||||
arch=$2
|
||||
|
||||
pushd "$basedir"
|
||||
|
||||
destDir="$outputDir/$platform-$arch"
|
||||
mkdir -p "$destDir"
|
||||
|
||||
# build binary
|
||||
moduleName="github.com/dnote/dnote"
|
||||
ldflags="-X '$moduleName/pkg/server/buildinfo.CSSFiles=main.css' -X '$moduleName/pkg/server/buildinfo.JSFiles=main.js' -X '$moduleName/pkg/server/buildinfo.Version=$version' -X '$moduleName/pkg/server/buildinfo.Standalone=true'"
|
||||
tags="fts5"
|
||||
|
||||
GOOS="$platform" \
|
||||
GOARCH="$arch" go build \
|
||||
-o "$destDir/dnote-server" \
|
||||
pushd "$projectDir"
|
||||
|
||||
xgo \
|
||||
-go go-1.25.x \
|
||||
-targets="$platform/$arch" \
|
||||
-ldflags "$ldflags" \
|
||||
"$basedir"/*.go
|
||||
-dest="$destDir" \
|
||||
-out="server" \
|
||||
-tags "$tags" \
|
||||
-pkg pkg/server \
|
||||
.
|
||||
|
||||
popd
|
||||
|
||||
mv "$destDir/server-${platform}-"* "$destDir/dnote-server"
|
||||
|
||||
# build tarball
|
||||
tarballName="dnote_server_${version}_${platform}_${arch}.tar.gz"
|
||||
tarballPath="$outputDir/$tarballName"
|
||||
|
|
@ -62,5 +69,8 @@ build() {
|
|||
|
||||
}
|
||||
|
||||
# install the tool
|
||||
go install src.techknowlogick.com/xgo@latest
|
||||
|
||||
build linux amd64
|
||||
build linux arm64
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue