-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #802 from Bacon-Fixation/docker-compose-rewrite
Revised Docker Implementation
- Loading branch information
Showing
4 changed files
with
141 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM --platform=linux/amd64 node:18-slim | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
WORKDIR "/Master-Bot" | ||
|
||
# Ports for the Dashboard | ||
EXPOSE 3000 | ||
ENV PORT 3000 | ||
|
||
# Install prerequisites and register fonts | ||
RUN apt-get update && apt-get upgrade -y -q && \ | ||
apt-get install -y -q openssl && \ | ||
apt-get install -y -q --no-install-recommends libfontconfig1 && \ | ||
npm install -g pnpm | ||
|
||
# Copy files to Container (Excluding whats in .dockerignore) | ||
COPY ./ ./ | ||
RUN pnpm install --ignore-scripts && pnpm -F * build | ||
|
||
# If you are running Master-Bot in a Standalone Container and need to connect to a service on localhost uncomment the following ENV for each service running on the containers host | ||
# ENV POSTGRES_HOST="host.docker.internal" | ||
# ENV REDIS_HOST="host.docker.internal" | ||
# ENV LAVA_HOST="host.docker.internal" | ||
|
||
# Uncomment the following for Standalone Master-Bot Docker Container Build | ||
# RUN pnpm db:push | ||
# CMD ["pnpm", "-r", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
version: '3' | ||
services: | ||
master-bot: | ||
platform: 'linux/amd64' | ||
env_file: | ||
- docker.env | ||
restart: always | ||
build: . | ||
ports: | ||
- '3000:3000' # Dashboard | ||
# - "5555:5555" # Prisma Studio Port - uncomment to open | ||
command: > | ||
sh -c "pnpm run db:push && pnpm run -r start" | ||
depends_on: | ||
lavalink: | ||
condition: service_healthy | ||
postgres: | ||
condition: service_healthy | ||
redis: | ||
condition: service_healthy | ||
environment: | ||
POSTGRES_USER: ${POSTGRES_USER} | ||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} # Password is required and must match '.env' file | ||
POSTGRES_DB_NAME: ${POSTGRES_DB_NAME} # Must match '.env' file | ||
POSTGRES_PORT: ${POSTGRES_PORT} | ||
POSTGRES_HOST: ${POSTGRES_HOST} # Must match '.env' file | ||
REDIS_HOST: ${REDIS_HOST} # Must match service name | ||
REDIS_PORT: ${REDIS_PORT} | ||
REDIS_DB: ${REDIS_DB} | ||
links: | ||
- lavalink | ||
- redis | ||
- postgres | ||
volumes: | ||
- ./logs:/Master-Bot/apps/bot/logs | ||
lavalink: | ||
restart: always | ||
image: fredboat/lavalink:3-alpine | ||
healthcheck: | ||
test: 'echo lavalink' | ||
interval: 10s | ||
timeout: 10s | ||
retries: 3 | ||
volumes: | ||
- ./application.yml:/opt/Lavalink/application.yml | ||
postgres: | ||
env_file: | ||
- docker.env | ||
image: postgres:15-alpine | ||
restart: always | ||
healthcheck: | ||
test: | ||
['CMD-SHELL', 'pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB_NAME}'] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
environment: | ||
- POSTGRES_USER=${POSTGRES_USER} | ||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} | ||
- POSTGRES_DB_NAME=${POSTGRES_DB_NAME} | ||
- POSTGRES_PORT=${POSTGRES_PORT} | ||
volumes: | ||
- postgres:/var/lib/postgresql/data | ||
redis: | ||
env_file: | ||
- docker.env | ||
image: redis:7-alpine | ||
restart: always | ||
environment: | ||
- ALLOW_EMPTY_PASSWORD=yes | ||
- REDIS_PORT=${REDIS_PORT} | ||
- REDIS_DB=${REDIS_DB} | ||
command: redis-server --save 20 1 --loglevel warning | ||
healthcheck: | ||
test: ['CMD', 'redis-cli', 'ping'] | ||
interval: 10s | ||
timeout: 10s | ||
retries: 3 | ||
volumes: | ||
- redis:/data | ||
volumes: | ||
postgres: | ||
driver: local | ||
redis: | ||
driver: local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Editing this file is not required and used for Docker-Compose Only | ||
# these will overwrite the needed .env variables to create and link ALL the containers correctly | ||
# Fill out your .env as normal then to dockerize | ||
# run "docker compose --env-file docker.env up -d --build" in root folder | ||
|
||
# Prisma Override | ||
DATABASE_URL="postgresql://postgresUsername:postgresPassword@postgres:5432/master-bot?schema=public&connect_timeout=300" | ||
|
||
# LavaLink Docker Container | ||
LAVA_HOST="lavalink" | ||
LAVA_PASS="youshallnotpass" | ||
LAVA_PORT=2333 | ||
LAVA_SECURE=false | ||
|
||
# Postgres Docker Container | ||
POSTGRES_HOST="postgres" | ||
POSTGRES_USER="postgresUsername" | ||
POSTGRES_PORT=5432 | ||
POSTGRES_PASSWORD="postgresPassword" | ||
POSTGRES_DB_NAME="master-bot" | ||
|
||
# Redis Docker Container | ||
REDIS_HOST="redis" | ||
REDIS_PORT=6379 | ||
REDIS_DB=0 | ||
REDIS_PASSWORD="redisPassword" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters