Skip to content

Commit 121c92a

Browse files
committed
feat: multi arch docker image and arm support
1 parent f8d8c0c commit 121c92a

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

Dockerfile

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
1-
# Docker image using pre-compiled binaries for pocket-relay
21
FROM alpine
32

43
# Version listed on github
54
ARG GITHUB_RELEASE_VERSION
5+
ARG TARGETARCH
66

7-
RUN apk update && apk upgrade
8-
RUN apk add curl
9-
10-
# Set the working directory
7+
# Setup working directory
118
WORKDIR /app
129

13-
# Download server executable
14-
RUN curl -LJ -o pocket-relay-linux https://github.com/PocketRelay/Server/releases/download/v${GITHUB_RELEASE_VERSION}/pocket-relay-linux?v=1
10+
# Install necessary tools
11+
RUN apk update && apk upgrade
12+
RUN apk add curl
1513

16-
# Make the server executable
17-
RUN chmod +x ./pocket-relay-linux
14+
# Determine binary based on arch
15+
RUN if [ "$TARGETARCH" = "amd64" ]; then \
16+
BINARY="pocket-relay-x86_64-linux-musl"; \
17+
elif [ "$TARGETARCH" = "arm64" ]; then \
18+
BINARY="pocket-relay-aarch64-linux-musl"; \
19+
else \
20+
echo "Unsupported architecture: $TARGETARCH" && exit 1; \
21+
fi && \
22+
# Download pocket-relay binary
23+
curl -L -o pocket-relay https://github.com/PocketRelay/Server/releases/download/v${GITHUB_RELEASE_VERSION}/$BINARY && \
24+
# Make binary executable
25+
chmod +x pocket-relay
1826

1927
# Volume for storing database file data
2028
VOLUME /app/data
2129

22-
# Expore app port
30+
# Expose app port
2331
EXPOSE 80
2432
EXPOSE 9032/udp
2533

26-
CMD ["/app/pocket-relay-linux"]
27-
28-
34+
CMD ["/app/pocket-relay"]

Makefile.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ run_task = [
5454
condition = { env_set = ["DOCKER_IMAGE_TAG", "GITHUB_RELEASE_VERSION"] }
5555
command = "docker"
5656
args = [
57+
"buildx",
5758
"build",
59+
"--platform",
60+
"linux/amd64,linux/arm64",
5861
".",
5962
"-t",
6063
"${DOCKER_IMAGE_TAG}",
@@ -81,7 +84,6 @@ run_task = [
8184
], parallel = true },
8285
]
8386

84-
8587
# ---- Pushing docker tags ----
8688

8789
# Publishes the docker image using the DOCKER_IMAGE_TAG tag
@@ -93,7 +95,6 @@ command = "docker"
9395
args = ["push", "${DOCKER_IMAGE_TAG}"]
9496
dependencies = ["build-docker"]
9597

96-
9798
# Publish the docker image using a tag created from the verson in Cargo.toml
9899
[tasks.publish-docker-version]
99100
condition = { env_set = [

0 commit comments

Comments
 (0)