Skip to content

Commit

Permalink
chore: Update Dockerfile to determine the target based on the platfor…
Browse files Browse the repository at this point in the history
…m and build with the specified target
  • Loading branch information
vitorfdl committed Jun 19, 2024
1 parent 81ed055 commit 0bc2b70
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,20 @@ ADD . ${TAGOIO_SOURCE_FOLDER}

RUN touch .env

# Build the project
RUN cargo build --release
# Determine the target based on the platform
RUN set -e; \
TARGET=$(uname -m); \
if [ "$TARGET" = "x86_64" ]; then \
TARGET="x86_64-unknown-linux-gnu"; \
elif [ "$TARGET" = "aarch64" ]; then \
TARGET="aarch64-unknown-linux-gnu"; \
elif [ "$TARGET" = "armv7l" ]; then \
TARGET="armv7-unknown-linux-gnueabihf"; \
else \
echo "Unsupported architecture: $TARGET"; exit 1; \
fi; \
rustup target add $TARGET && \
cargo build --release --target $TARGET

# Unset the SSL environment variables
RUN unset CARGO_SERVER_SSL_CA CARGO_SERVER_SSL_CERT CARGO_SERVER_SSL_KEY
Expand Down
2 changes: 1 addition & 1 deletion dockerhub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ docker buildx build --push --build-arg TAGORELAY_VERSION=${FULL_VERSION} \
--build-arg CARGO_SERVER_SSL_CA=${CARGO_SERVER_SSL_CA_BASE64} \
--build-arg CARGO_SERVER_SSL_CERT=${CARGO_SERVER_SSL_CERT_BASE64} \
--build-arg CARGO_SERVER_SSL_KEY=${CARGO_SERVER_SSL_KEY_BASE64} \
--platform linux/arm/v7,linux/amd64 \
--platform linux/arm/v7,linux/arm64/v8,linux/amd64 \
--tag tagoio/relay \
--tag tagoio/relay:debian \
--tag tagoio/relay:bullseye \
Expand Down

0 comments on commit 0bc2b70

Please sign in to comment.