Skip to content

Commit 90dbcd3

Browse files
authored
Merge pull request #64 from rHomelab/refactor/image_improvements
2 parents f2e8cc4 + 5b60475 commit 90dbcd3

File tree

2 files changed

+54
-51
lines changed

2 files changed

+54
-51
lines changed

Dockerfile

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
FROM python:3.11-slim-bullseye
1+
FROM python:3.11-slim-trixie
22

3-
ARG DEBIAN_FRONTEND=noninteractive
3+
ARG DEBIAN_FRONTEND=noninteractive \
4+
RED_UID=1024 \
5+
RED_GID=1024
46

5-
ENV PYTHONUNBUFFERED=1
6-
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
7+
ENV PYTHONUNBUFFERED=1 \
8+
PIP_DISABLE_PIP_VERSION_CHECK=1 \
9+
RED_HOME=/redbot \
10+
RED_USER=reduser
711

8-
ENV RED_HOME=/redbot
9-
ENV RED_USER=reduser
10-
ARG RED_UID=1024
11-
ARG RED_GID=1024
1212
ENV PATH="${RED_HOME}/.local/bin:${PATH}"
1313

1414
RUN groupadd -r -g $RED_GID ${RED_USER} && \
@@ -17,14 +17,18 @@ RUN groupadd -r -g $RED_GID ${RED_USER} && \
1717
ln -sv ${RED_HOME}/data ${RED_HOME}/.config/Red-DiscordBot && \
1818
chown -Rv ${RED_USER}:${RED_USER} $RED_HOME
1919

20-
COPY redbot/requirements.txt ${RED_HOME}/
20+
# Keep extra apt caches to speed up subsequent builds
21+
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
2122

22-
RUN apt update && \
23-
apt --no-install-recommends -y install build-essential git openjdk-11-jre-headless units tini && \
24-
su $RED_USER -c "python -m pip install --no-cache-dir --user -r ${RED_HOME}/requirements.txt" && \
23+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
24+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
25+
--mount=type=cache,target=${RED_HOME}/.cache/pip,sharing=locked \
26+
--mount=type=bind,source=redbot/requirements.txt,target=${RED_HOME}/requirements.txt \
27+
apt update && \
28+
apt --no-install-recommends -y install build-essential git openjdk-21-jre-headless units tini && \
29+
su $RED_USER -c "python -m pip install --user -r ${RED_HOME}/requirements.txt" && \
2530
apt remove -y build-essential && \
26-
apt autoremove -y && \
27-
rm -rf /var/lib/apt/lists/*
31+
apt autoremove -y
2832

2933
COPY --chmod=755 redbot/*.sh ${RED_HOME}/
3034

README.md

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,18 @@
55

66
[Red Discord Bot](https://discord.red), now containerised.
77

8-
> [!NOTE]
9-
> This is an unsupported deployment method for Red. Do not expect support from the developers of Red Discord Bot if you run into any issues.
10-
11-
* [Tags](#tags)
12-
* [Environment Variables](#environment-variables)
13-
* [Additional Options](#additional-options)
14-
* [Setup](#setup)
8+
* [Getting Started](#getting-started)
159
* [Prerequisites](#prerequisites)
1610
* [Running the bot with `docker compose`](#running-the-bot-with-docker-compose)
1711
* [Running the bot with `docker run`](#running-the-bot-with-docker-run)
18-
* [Migrating from `rhomelab:labbot`](#migrating-from-rhomelablabbot)
19-
20-
## Tags
21-
22-
| **Tags** | **Red version** |
23-
|:------------:|:--------------------------------------------------------------------------------:|
24-
| `latest` | [Latest release](https://github.com/Cog-Creators/Red-DiscordBot/releases/latest) |
25-
| x.x.x | See tag |
26-
27-
## Environment Variables
28-
29-
| Name | Description | Type | Default |
30-
|---------------------------|-----------------------------------------------------------------------------------------|---------|----------|
31-
| `INSTANCE_NAME` | The name of your Red Bot instance.<br>Example: `MyBot` | string | `RedBot` |
32-
| `PREFIX` | Your bot's command prefix.<br>Example: `!` | string | |
33-
| `TOKEN` | Your bot token from Discord Developers. | string | |
34-
| `RPC_ENABLED` | Whether [RPC](https://docs.discord.red/en/stable/framework_rpc.html) is enabled or not. | boolean | `false` |
35-
| `RPC_PORT` | The port used by Red's RPC server, if enabled. | string | `6133` |
36-
| `TEAM_MEMBERS_ARE_OWNERS` | Treat Discord Developers application team members as owners. | boolean | `false` |
37-
| `PIP_REQUIREMENTS` | Optional space-separated list of pip packages to install. | string | |
38-
39-
### Additional Options
40-
41-
If you wish to pass additional options to the `redbot` command, these can be added to the `command` option in [`docker-compose.yml`](docker-compose-example.yml) or appended to the `docker run` command.
42-
43-
> [!WARNING]
44-
> Do not add arguments which conflict with existing environment variables, such as `--prefix`, `--rpc`, etc.
12+
* [Tags](#tags)
13+
* [Environment Variables](#environment-variables)
14+
* [Additional Options](#additional-options)
4515

46-
> [!TIP]
47-
> You can see a full list of `redbot` options [here](https://github.com/rHomelab/Red-DiscordBot-Docker/blob/main/.github/redbot-arguments.txt).
16+
> [!NOTE]
17+
> This is an unsupported deployment method for Red. Do not expect support from the developers of Red Discord Bot if you run into any issues.
4818
49-
## Setup
19+
## Getting Started
5020

5121
See the [`docker-compose-example.yml`](docker-compose-example.yml) for a basic example of a working bot with Docker Compose.
5222

@@ -90,3 +60,32 @@ docker run -d \
9060
```
9161

9262
To retrieve the invitation URL, run `docker logs RedBot`. If you only started the container a few moments ago, you may need to wait a few seconds for the bot to be created, started, and connected.
63+
64+
## Tags
65+
66+
| Tag | Description |
67+
| -------- | -------------------------------------------------------------------------------------------------- |
68+
| `latest` | [Latest release](https://github.com/Cog-Creators/Red-DiscordBot/releases/latest) of Red-DiscordBot |
69+
| `x.x.x` | Specified version of Red-DiscordBot (e.g. tag `1.2.3` would be Red version `1.2.3`) |
70+
71+
## Environment Variables
72+
73+
| Name | Description | Type | Default |
74+
| ------------------------- | --------------------------------------------------------------------------------------- | ------- | -------- |
75+
| `INSTANCE_NAME` | The name of your Red Bot instance.<br>Example: `MyBot` | string | `RedBot` |
76+
| `PREFIX` | Your bot's command prefix.<br>Example: `!` | string | |
77+
| `TOKEN` | Your bot token from Discord Developers. | string | |
78+
| `RPC_ENABLED` | Whether [RPC](https://docs.discord.red/en/stable/framework_rpc.html) is enabled or not. | boolean | `false` |
79+
| `RPC_PORT` | The port used by Red's RPC server, if enabled. | string | `6133` |
80+
| `TEAM_MEMBERS_ARE_OWNERS` | Treat Discord Developers application team members as owners. | boolean | `false` |
81+
| `PIP_REQUIREMENTS` | Optional space-separated list of pip packages to install. | string | |
82+
83+
### Additional Options
84+
85+
If you wish to pass additional options to the `redbot` command, these can be added to the `command` option in [`docker-compose.yml`](docker-compose-example.yml) or appended to the `docker run` command.
86+
87+
> [!WARNING]
88+
> Do not add arguments which conflict with existing environment variables, such as `--prefix`, `--rpc`, etc.
89+
90+
> [!TIP]
91+
> You can see a full list of `redbot` options [here](https://github.com/rHomelab/Red-DiscordBot-Docker/blob/main/.github/redbot-arguments.txt).

0 commit comments

Comments
 (0)