From 490c94ca501cad9df0bf9c68330350e3179bb61b Mon Sep 17 00:00:00 2001 From: nils <48135649+Nilstrieb@users.noreply.github.com> Date: Mon, 5 Sep 2022 16:03:13 +0200 Subject: [PATCH] dockerized --- Dockerfile | 30 ++++++++++++++++++++++++++++++ run.sh | 4 ++++ 2 files changed, 34 insertions(+) create mode 100644 Dockerfile create mode 100644 run.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..168da4e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM rust as build + +RUN rustup toolchain install nightly +RUN rustup default nightly +RUN rustup target add x86_64-unknown-linux-musl + +RUN apt-get update +RUN apt-get install musl-tools -y + +WORKDIR /app +COPY Cargo.toml Cargo.lock ./ +RUN mkdir src +RUN echo "fn main() {}" > src/main.rs + +RUN cargo build --release -Zsparse-registry --target x86_64-unknown-linux-musl + +COPY src ./src + +# now rebuild with the proper main +RUN touch src/main.rs +RUN cargo build --release -Zsparse-registry --target x86_64-unknown-linux-musl + +### RUN +FROM scratch + +WORKDIR /app + +COPY --from=build /app/target/x86_64-unknown-linux-musl/release/widertom widertom + +CMD ["/app/widertom"] \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..e7c7691 --- /dev/null +++ b/run.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +docker run -d -v "$(pwd)/config.toml:/app/config.toml" -v "$(pwd)/bot_token:/app/bot_token" \ + -e CONFIG_PATH=/app/config.toml -e BOT_TOKEN_PATH=/app/bot_token --name widertom widertom:1.0