-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,23 @@ | |
FROM rust:1-buster AS build-env | ||
|
||
ARG TAG | ||
ARG PROTOC_VERSION=28.3 | ||
|
||
WORKDIR /root | ||
|
||
# Install protoc | ||
RUN ARCH=$(uname -m) && \ | ||
if [ "$ARCH" = "x86_64" ]; then \ | ||
ARCH=x86_64; \ | ||
elif [ "$ARCH" = "aarch64" ]; then \ | ||
ARCH=aarch_64;\ | ||
else \ | ||
echo "Unsupported architecture: $ARCH"; exit 1; \ | ||
fi && \ | ||
wget https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-linux-$ARCH.zip -O /tmp/protoc.zip && \ | ||
unzip /tmp/protoc.zip -d /usr/local && \ | ||
rm -rf /tmp/protoc.zip | ||
|
||
COPY . . | ||
RUN cargo build --release | ||
|
||
|
@@ -17,12 +31,24 @@ LABEL maintainer="[email protected]" | |
ARG UID=2000 | ||
ARG GID=2000 | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates | ||
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates wget | ||
RUN update-ca-certificates | ||
RUN groupadd -g ${GID} hermes && useradd -l -m hermes -s /bin/bash -u ${UID} -g ${GID} | ||
|
||
WORKDIR /home/hermes | ||
|
||
RUN ARCH=$(uname -m) && \ | ||
if [ "$ARCH" = "x86_64" ]; then \ | ||
DEB_URL=http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.23_amd64.deb; \ | ||
elif [ "$ARCH" = "aarch64" ]; then \ | ||
DEB_URL=http://ports.ubuntu.com/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_arm64.deb; \ | ||
else \ | ||
echo "Unsupported architecture: $ARCH"; exit 1; \ | ||
fi && \ | ||
wget $DEB_URL -O /tmp/libssl1.1.deb && \ | ||
dpkg -i /tmp/libssl1.1.deb && \ | ||
rm -rf /tmp/libssl1.1.deb | ||
|
||
USER hermes:hermes | ||
ENTRYPOINT ["/usr/bin/hermes"] | ||
|
||
COPY --chown=hermes:hermes --from=build-env /root/target/release/hermes /usr/bin/hermes |