-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
79 additions
and
0 deletions.
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,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" ] |
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,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: |
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 @@ | ||
#!/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 |
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,3 @@ | ||
TOKEN= | ||
OWNER= | ||
PREFIX=! |