Setup Docker container
This commit is contained in:
parent
c5eb818a12
commit
2b2dcb1b55
5
.dockerignore
Normal file
5
.dockerignore
Normal file
@ -0,0 +1,5 @@
|
||||
.vscode
|
||||
target
|
||||
.env
|
||||
.gitignore
|
||||
renovate.json
|
13
Dockerfile
Normal file
13
Dockerfile
Normal file
@ -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" ]
|
9
docker-compose.yml
Normal file
9
docker-compose.yml
Normal file
@ -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
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user