diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3fddeae --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.vscode +target +.env +.gitignore +renovate.json diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d901827 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM rust:1.74-alpine3.18 AS compiler +ENV RUSTFLAGS="-C target-feature=-crt-static" +RUN apk add --no-cache openssl-dev musl-dev +WORKDIR /usr/src/rustbot +RUN cargo build || true +COPY . . +RUN cargo fetch && cargo build -r + +FROM alpine:3.19 +RUN apk add --no-cache openssl-dev libgcc +WORKDIR /rustbot +COPY --from=compiler /usr/src/rustbot/target/release/rustbot . +CMD [ "./rustbot" ] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..bcbed8f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: '3.8' +services: + bot: + container_name: Rustbot + image: 'git.toast-server.net/toast/rustbot:main' + build: . + env_file: + - .env + restart: unless-stopped diff --git a/src/commands/eval.rs b/src/commands/eval.rs index cfe52ea..9522bec 100644 --- a/src/commands/eval.rs +++ b/src/commands/eval.rs @@ -33,6 +33,7 @@ pub async fn eval( // Compile let compiled_path = dir.path().join("temp"); + println!("Compiling {} -> {}", file_path.display(), compiled_path.display()); let output = Command::new("rustc").arg(&file_path).arg("-o").arg(&compiled_path).output()?; if !output.status.success() {