diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..14dac8e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,14 @@ +# Docker files +Dockerfile +.dockerignore + +# Git files +.git +.github +.gitignore +LICENSE +README.md + +# Cargo files +**/*.rs.bk +/target/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..18e7bda --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +# Build image +FROM rust:slim-bullseye as build + +RUN apt-get update && apt-get install -y \ + build-essential autoconf automake cmake libtool libssl-dev pkg-config + +WORKDIR "/app" + +# Cache cargo build dependencies by creating a dummy source +RUN mkdir src +RUN echo "fn main() {}" > src/main.rs +COPY Cargo.toml ./ +COPY Cargo.lock ./ +RUN cargo build --release --locked + +COPY . . +RUN cargo build --release --locked + +# Release image +FROM debian:bullseye-slim + +RUN apt-get update && apt-get install -y python3-pip ffmpeg +RUN pip install -U yt-dlp + +COPY --from=build /app/target/release/djheuel . + +CMD ["./djheuel"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..07275e1 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +--- +version: "2.1" +services: + djheuel: + build: . + container_name: DJHeuel + restart: unless-stopped + environment: + - DISCORD_TOKEN=${DISCORD_TOKEN} + - DISCORD_APP_ID=${DISCORD_APP_ID}