64 lines
2.1 KiB
YAML
64 lines
2.1 KiB
YAML
services:
|
|
lavalink:
|
|
image: fredboat/lavalink:latest
|
|
container_name: lavalink
|
|
restart: unless-stopped
|
|
networks:
|
|
- bot-network
|
|
ports:
|
|
- "2333:2333"
|
|
environment:
|
|
LAVALINK_SERVER_PASSWORD: ${LAVALINK_PASSWORD}
|
|
# Add environment variable for plugin URLs (using the format you provided)
|
|
LAVALINK_PLUGIN_URLS: |
|
|
https://github.com/lavalink-devs/youtube-source/releases/download/1.12.0/youtube-plugin-1.12.0.jar
|
|
volumes:
|
|
- ./application.yml:/opt/Lavalink/application.yml:ro,Z
|
|
# Optional: Persist downloaded plugins if needed, though downloading on start is fine
|
|
# - lavalink-plugins:/plugins
|
|
# Add healthcheck to verify Lavalink is ready
|
|
healthcheck:
|
|
# Use CMD-SHELL to allow environment variable expansion for the password
|
|
test: ["CMD-SHELL", "curl -H \"Authorization: $$LAVALINK_SERVER_PASSWORD\" -f http://localhost:2333/version || exit 1"]
|
|
interval: 10s # Increased interval slightly
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 15s # Give Lavalink time to start up initially
|
|
# Override entrypoint/command to download plugins first
|
|
command: >
|
|
sh -c "
|
|
apk add --no-cache curl && \
|
|
mkdir -p /plugins && \
|
|
echo 'Downloading Lavalink plugins...' && \
|
|
echo \"$$LAVALINK_PLUGIN_URLS\" | while IFS= read -r url; do \
|
|
if [ -n \"$$url\" ]; then \
|
|
filename=$(basename \"$$url\") && \
|
|
echo \"Downloading $$url to /plugins/$$filename\" && \
|
|
curl -L -o \"/plugins/$$filename\" \"$$url\"; \
|
|
fi \
|
|
done && \
|
|
echo 'Downloads complete. Starting Lavalink...' && \
|
|
java -jar Lavalink.jar
|
|
"
|
|
|
|
bot:
|
|
build: .
|
|
container_name: discord-music-bot
|
|
restart: unless-stopped
|
|
networks:
|
|
- bot-network
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
LAVALINK_HOST: lavalink
|
|
LAVALINK_PORT: 2333
|
|
LAVALINK_PASSWORD: ${LAVALINK_PASSWORD}
|
|
# Update depends_on to wait for healthcheck
|
|
depends_on:
|
|
lavalink:
|
|
condition: service_healthy
|
|
|
|
networks:
|
|
bot-network:
|
|
driver: bridge
|