Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Docker image #6505

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions docker/Dockerfile.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM debian:bookworm-slim AS build

RUN apt update && apt install -y --no-install-recommends \
python3 python3-dev python3-venv build-essential ca-certificates

RUN useradd -u 1000 -U -m red
USER red
WORKDIR /home/red

RUN bash -c \
'python3 -m venv .redenv && \
source .redenv/bin/activate && \
pip install Red-DiscordBot && \
rm -rf .cache && \
redbot-setup \
--no-prompt \
--instance-name RedBot \
--data-path /home/red/data \
--overwrite-existing-instance \
--backend json'

FROM debian:bookworm-slim

RUN apt update && apt install -y --no-install-recommends \
python3 python3-venv openjdk-17-jre-headless ca-certificates

RUN useradd -u 1000 -U -m red
USER red
WORKDIR /home/red

COPY --chown=red:red --from=build /home/red /home/red

COPY --chown=red:red start.sh /home/red/start.sh
RUN chmod +x /home/red/start.sh && mkdir /home/red/data

ENTRYPOINT [ "/home/red/start.sh" ]
14 changes: 14 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
services:
red-bot:
image: red-bot
build:
context: .
dockerfile: Dockerfile.release
tags:
- red-bot
env_file: .env
volumes:
- data:/home/red/data

volumes:
data:
26 changes: 26 additions & 0 deletions docker/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

set -e

source .redenv/bin/activate

PREFIX="${PREFIX:-!}"

[ -z "$OWNER" ] && echo "Set the OWNER!" && exit 1
[ -z "$TOKEN" ] && echo "Set the TOKEN!" && exit 1

if [ -z "$(ls -A data)" ]; then
redbot-setup \
--no-prompt \
--instance-name RedBot \
--data-path /home/red/data \
--overwrite-existing-instance \
--backend json
fi

redbot RedBot \
--no-prompt \
--token "${TOKEN}" \
--owner "${OWNER}" \
--prefix "${PREFIX}" \
--mentionable
3 changes: 3 additions & 0 deletions docker/template.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TOKEN=
OWNER=
PREFIX=!
Loading