From a75e02e7d96e048419300a5951534939b6e7b984 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Thu, 1 Sep 2022 21:39:57 +0200 Subject: [PATCH] dockering around --- .dockerignore | 4 +++- Dockerfile | 13 +++++++++---- entrypoint.sh | 7 ------- run.sh | 1 + 4 files changed, 13 insertions(+), 12 deletions(-) delete mode 100644 entrypoint.sh create mode 100755 run.sh diff --git a/.dockerignore b/.dockerignore index 9f97022..4cc7845 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,3 @@ -target/ \ No newline at end of file +target/ +.idea/ +config.json \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 3d80d8c..8ab434f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,24 +2,29 @@ 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 +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 +RUN cargo build --release -Zsparse-registry --target x86_64-unknown-linux-musl -FROM debian:latest +### RUN +FROM scratch WORKDIR /app -COPY --from=build /app/target/release/killjoy_turret killjoy_turret +COPY --from=build /app/target/x86_64-unknown-linux-musl/release/killjoy_turret killjoy_turret CMD ["/app/killjoy_turret"] diff --git a/entrypoint.sh b/entrypoint.sh deleted file mode 100644 index 2dfb9c3..0000000 --- a/entrypoint.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -while true ; -do - /usr/local/bin/killjoy_turret - sleep 10 -done \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..63bd7d4 --- /dev/null +++ b/run.sh @@ -0,0 +1 @@ +docker run -d -v (pwd)/config.json:/app/config.json -e CONFIG_PATH=/app/config.json killjoy-turret:1.0 \ No newline at end of file