-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #550 from Hou-Xiaoxuan/docker_aries
chore: Add Dockerfile for Aries engine
- Loading branch information
Showing
7 changed files
with
131 additions
and
12 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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
name = "aries" | ||
version = "0.1.0" | ||
edition = "2021" | ||
build = "src/build.rs" | ||
|
||
[[bin]] | ||
name = "aries" | ||
|
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
fn main() { | ||
#[cfg(target_os = "linux")] | ||
println!("cargo:rustc-link-arg=-Wl,-rpath,$ORIGIN"); | ||
#[cfg(target_os = "macos")] | ||
println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path"); | ||
} |
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
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
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
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
FROM debian:bookworm-slim AS builder | ||
|
||
WORKDIR /opt/mega | ||
|
||
# build args, to specify the build type, release or debug | ||
ARG BUILD_TYPE=release | ||
|
||
# check arg value | ||
RUN if [ "$BUILD_TYPE" != "release" ] && [ "$BUILD_TYPE" != "debug" ]; then \ | ||
echo "Invalid BUILD_TYPE: $BUILD_TYPE, must be release or debug"; \ | ||
exit 1; \ | ||
fi | ||
|
||
# set mirror for apt | ||
# RUN echo "deb http://mirrors.ustc.edu.cn/debian bookworm main contrib non-free" > /etc/apt/sources.list && \ | ||
# echo "deb http://mirrors.ustc.edu.cn/debian-security bookworm-security main contrib non-free" >> /etc/apt/sources.list && \ | ||
# echo "deb http://mirrors.ustc.edu.cn/debian bookworm-updates main contrib non-free" >> /etc/apt/sources.list | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
cmake \ | ||
clang \ | ||
build-essential | ||
|
||
RUN apt-get install -y \ | ||
nodejs \ | ||
npm | ||
|
||
RUN apt-get install -y \ | ||
curl \ | ||
wget \ | ||
file \ | ||
libssl-dev \ | ||
libgtk-3-dev \ | ||
libayatana-appindicator3-dev \ | ||
librsvg2-dev \ | ||
ca-certificates \ | ||
&& curl https://sh.rustup.rs -sSf | sh -s -- -y \ | ||
&& . $HOME/.cargo/env | ||
|
||
ENV PATH=/root/.cargo/bin:$PATH | ||
|
||
# copy the source code, the context must be the root of the project | ||
COPY . . | ||
|
||
# build | ||
RUN if [ "$BUILD_TYPE" = "release" ]; then \ | ||
cargo build -p aries --release; \ | ||
else \ | ||
cargo build -p aries; \ | ||
fi | ||
|
||
# final image | ||
FROM debian:bookworm-slim | ||
|
||
RUN apt-get update && apt-get install -y libssl-dev ca-certificates | ||
|
||
ARG BUILD_TYPE=release | ||
|
||
COPY --from=builder /opt/mega/target/$BUILD_TYPE/aries /usr/local/bin/aries | ||
COPY --from=builder /opt/mega/docker/start-aries.sh /usr/local/bin/start-aries.sh | ||
RUN chmod +x /usr/local/bin/start-aries.sh | ||
RUN chmod +x /usr/local/bin/aries | ||
COPY --from=builder /opt/mega/target/$BUILD_TYPE/libpipy.so /usr/local/lib/libpipy.so | ||
# refresh shared library cache | ||
RUN ldconfig | ||
|
||
VOLUME /opt/mega | ||
|
||
CMD ["bash", "-c", "/usr/local/bin/start-aries.sh"] |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
export MEGA_BASE_DIR="/opt/mega" | ||
CONFIG_FILE="$MEGA_BASE_DIR/etc/config.toml" | ||
|
||
if [ -f "$CONFIG_FILE" ]; then | ||
echo "Using config file: $CONFIG_FILE" | ||
exec /usr/local/bin/aries -c "$CONFIG_FILE" | ||
else | ||
exec /usr/local/bin/aries | ||
fi |
5e52f4f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
mega – ./
mega-gitmono.vercel.app
gitmega.dev
www.gitmega.dev
mega-git-main-gitmono.vercel.app