Add multi-platform Docker support for ARM64, ARMv7, and 386

This commit is contained in:
Sung 2025-10-19 13:44:54 -07:00
commit acec12d46a
3 changed files with 36 additions and 6 deletions

View file

@ -55,10 +55,19 @@ jobs:
./scripts/generate-changelog.sh server "$TAG" "$PREV_TAG" > /tmp/changelog.txt
cat /tmp/changelog.txt
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Prepare Docker build context
run: |
VERSION="${{ steps.version.outputs.version }}"
cp build/server/dnote_server_${VERSION}_linux_amd64.tar.gz host/docker/
cp build/server/dnote_server_${VERSION}_linux_arm64.tar.gz host/docker/
cp build/server/dnote_server_${VERSION}_linux_arm.tar.gz host/docker/
cp build/server/dnote_server_${VERSION}_linux_386.tar.gz host/docker/
- name: Login to Docker Hub
uses: docker/login-action@v3
@ -71,11 +80,12 @@ jobs:
with:
context: ./host/docker
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/386
tags: |
dnote/dnote:${{ steps.version.outputs.version }}
dnote/dnote:latest
build-args: |
tarballName=dnote_server_${{ steps.version.outputs.version }}_linux_amd64.tar.gz
version=${{ steps.version.outputs.version }}
- name: Create GitHub release
env:

View file

@ -1,12 +1,30 @@
FROM busybox:glibc
ARG tarballName
RUN test -n "$tarballName"
ARG TARGETPLATFORM
ARG version
WORKDIR dnote
RUN test -n "$TARGETPLATFORM" || (echo "TARGETPLATFORM is required" && exit 1)
RUN test -n "$version" || (echo "version is required" && exit 1)
COPY "$tarballName" .
RUN tar -xvzf "$tarballName"
WORKDIR /tmp/tarballs
# Copy all architecture tarballs
COPY dnote_server_*.tar.gz ./
# Select and extract the correct tarball based on target platform
RUN case "$TARGETPLATFORM" in \
"linux/amd64") ARCH="amd64" ;; \
"linux/arm64") ARCH="arm64" ;; \
"linux/arm/v7") ARCH="arm" ;; \
"linux/386") ARCH="386" ;; \
*) echo "Unsupported platform: $TARGETPLATFORM" && exit 1 ;; \
esac && \
TARBALL="dnote_server_${version}_linux_${ARCH}.tar.gz" && \
echo "Extracting $TARBALL for $TARGETPLATFORM" && \
mkdir -p /dnote && \
tar -xvzf "$TARBALL" -C /dnote
WORKDIR /dnote
COPY entrypoint.sh .
ENTRYPOINT ["./entrypoint.sh"]

View file

@ -74,3 +74,5 @@ go install src.techknowlogick.com/xgo@latest
build linux amd64
build linux arm64
build linux arm
build linux 386