Compare commits
No commits in common. "4670e02981a207a9cb9444b817639e0c05aaf6c8" and "ba96e8c32f47a5f5ef6cc96ea749143acee48e11" have entirely different histories.
4670e02981
...
ba96e8c32f
@ -1,9 +0,0 @@
|
|||||||
# .dockerignore
|
|
||||||
|
|
||||||
.git
|
|
||||||
.gitignore
|
|
||||||
target/
|
|
||||||
.env
|
|
||||||
*.md
|
|
||||||
Lavalink.jar
|
|
||||||
application.yml
|
|
||||||
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serenity = { version = "0.12", features = ["builder", "cache", "client", "gateway", "model", "http", "rustls_backend", "voice", "collector"] }
|
serenity = { version = "0.12", features = ["builder", "cache", "client", "gateway", "model", "framework", "standard_framework", "http", "rustls_backend", "voice", "collector", "interactions"] }
|
||||||
lavalink-rs = { version = "0.14", features = ["serenity", "tungstenite-rustls-native-roots"] }
|
lavalink-rs = { version = "0.14", features = ["serenity", "tungstenite-rustls-native-roots"] }
|
||||||
tokio = { version = "1.44", features = ["full"] }
|
tokio = { version = "1.44", features = ["full"] }
|
||||||
dotenv = "0.15"
|
dotenv = "0.15"
|
||||||
|
|||||||
42
Dockerfile
42
Dockerfile
@ -1,42 +0,0 @@
|
|||||||
# Dockerfile
|
|
||||||
|
|
||||||
# ---- Planner Stage ----
|
|
||||||
# Use the official Rust Alpine image as a base for planning.
|
|
||||||
# We use the same base image for planner and builder for consistency.
|
|
||||||
FROM rust:1-alpine AS planner
|
|
||||||
WORKDIR /app
|
|
||||||
# Install cargo-chef for build caching
|
|
||||||
RUN apk add --no-cache musl-dev # Needed by chef
|
|
||||||
RUN cargo install cargo-chef --locked
|
|
||||||
COPY . .
|
|
||||||
# Compute dependencies. This output will be cached if Cargo.toml/lock haven't changed.
|
|
||||||
RUN cargo chef prepare --recipe-path recipe.json
|
|
||||||
|
|
||||||
# ---- Builder Stage ----
|
|
||||||
# Use the same Rust Alpine image for building.
|
|
||||||
FROM rust:1-alpine AS builder
|
|
||||||
WORKDIR /app
|
|
||||||
# Install build dependencies for Alpine
|
|
||||||
RUN apk add --no-cache build-base openssl-dev pkgconfig
|
|
||||||
# Install cargo-chef again (could optimize but simpler this way)
|
|
||||||
RUN cargo install cargo-chef --locked
|
|
||||||
# Copy the dependency recipe from the planner stage
|
|
||||||
COPY --from=planner /app/recipe.json recipe.json
|
|
||||||
# Build dependencies based on the recipe. This layer is cached efficiently.
|
|
||||||
RUN cargo chef cook --release --recipe-path recipe.json
|
|
||||||
# Copy application code
|
|
||||||
COPY . .
|
|
||||||
# Build the application binary, linking against pre-built dependencies
|
|
||||||
# Ensure the binary name matches your package name in Cargo.toml
|
|
||||||
RUN cargo build --release --bin discord-music-bot-lavalink-rs
|
|
||||||
|
|
||||||
# ---- Runtime Stage ----
|
|
||||||
# Use a minimal Alpine image for the final runtime environment.
|
|
||||||
FROM alpine:latest
|
|
||||||
WORKDIR /app
|
|
||||||
# Install runtime dependencies needed by the binary (e.g., SSL certs)
|
|
||||||
RUN apk add --no-cache ca-certificates openssl
|
|
||||||
# Copy the compiled application binary from the builder stage
|
|
||||||
COPY --from=builder /app/target/release/discord-music-bot-lavalink-rs /app/
|
|
||||||
# Set the binary as the entrypoint
|
|
||||||
CMD ["./discord-music-bot-lavalink-rs"]
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
# application.yml (Example)
|
|
||||||
server: # REST and WS server
|
|
||||||
port: 2333
|
|
||||||
address: 0.0.0.0 # Listen on all interfaces within the container
|
|
||||||
lavalink:
|
|
||||||
server:
|
|
||||||
password: "youshallnotpass" # CHANGE THIS to a strong password
|
|
||||||
sources:
|
|
||||||
youtube: true
|
|
||||||
bandcamp: true
|
|
||||||
soundcloud: true
|
|
||||||
twitch: true
|
|
||||||
vimeo: true
|
|
||||||
http: true
|
|
||||||
local: false
|
|
||||||
# bufferDurationMs: 400 # How many milliseconds of audio to buffer? Lower values are less safe.
|
|
||||||
# youtubePlaylistLoadLimit: 6 # Number of pages at 100 tracks each
|
|
||||||
# playerUpdateInterval: 5 # How frequently to send player updates to clients, in seconds
|
|
||||||
# youtubeSearchEnabled: true
|
|
||||||
# soundcloudSearchEnabled: true
|
|
||||||
# bandcampSearchEnabled: true # Not implemented by LavaLink currently
|
|
||||||
# Default values are generally fine
|
|
||||||
# You can find more options here: https://github.com/lavalink-devs/Lavalink/blob/master/IMPLEMENTATION.md#configuration
|
|
||||||
logging:
|
|
||||||
file:
|
|
||||||
max-history: 30
|
|
||||||
max-size: 1GB
|
|
||||||
path: ./logs/
|
|
||||||
|
|
||||||
level:
|
|
||||||
root: INFO
|
|
||||||
lavalink: INFO
|
|
||||||
43
compose.yml
43
compose.yml
@ -1,43 +0,0 @@
|
|||||||
# docker-compose.yml
|
|
||||||
services:
|
|
||||||
# The Rust Discord Bot Service
|
|
||||||
app:
|
|
||||||
# Build the image from the Dockerfile in the current directory (.)
|
|
||||||
build: .
|
|
||||||
container_name: discord-bot-app
|
|
||||||
restart: unless-stopped
|
|
||||||
# Pass environment variables from the .env file
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
# Depend on the lavalink service to ensure it starts first (best practice)
|
|
||||||
depends_on:
|
|
||||||
- lavalink
|
|
||||||
|
|
||||||
# The LavaLink Service
|
|
||||||
lavalink:
|
|
||||||
# Use a Java Runtime Environment image (Alpine base for smaller size)
|
|
||||||
image: eclipse-temurin:17-jre-alpine
|
|
||||||
container_name: lavalink-server
|
|
||||||
restart: unless-stopped
|
|
||||||
# Set the working directory inside the container
|
|
||||||
working_dir: /opt/lavalink
|
|
||||||
# Mount the local Lavalink.jar and application.yml into the container
|
|
||||||
volumes:
|
|
||||||
- ./Lavalink.jar:/opt/lavalink/Lavalink.jar:ro,Z # Mount Jar read-only
|
|
||||||
- ./application.yml:/opt/lavalink/application.yml:ro,Z # Mount config read-only
|
|
||||||
- ./logs:/opt/lavalink/logs:Z # Mount logs directory (optional)
|
|
||||||
# Expose the LavaLink port to the host machine (optional, but useful for debugging)
|
|
||||||
# and makes it reachable by the 'app' service via Docker network.
|
|
||||||
ports:
|
|
||||||
- "2333:2333"
|
|
||||||
# Command to run LavaLink inside the container
|
|
||||||
command: ["java", "-jar", "Lavalink.jar"]
|
|
||||||
|
|
||||||
# Define networks (optional, Docker Compose creates a default one)
|
|
||||||
# networks:
|
|
||||||
# default:
|
|
||||||
# driver: bridge
|
|
||||||
|
|
||||||
# Define volumes (optional, if you need persistent data beyond logs)
|
|
||||||
# volumes:
|
|
||||||
# lavalink_logs:
|
|
||||||
Loading…
x
Reference in New Issue
Block a user