Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #25 from ItsDrike/add-locally-built-docker-compose
Browse files Browse the repository at this point in the history
Add locally built docker compose & docker usage instructions
  • Loading branch information
ItsDrike authored Jul 21, 2024
2 parents 40f4c0f + 6d787c4 commit ab90638
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,37 @@ You'll now need to configure the bot. See the [configuring section](#configuring

Finally, you can start the bot with `python -m src`.

### Using docker

The project also supports [docker](https://www.docker.com/) installation, which should allow running the project
anywhere, without installing all of the dependencies manually. This is a lot more convenient way to run the bot, if you
just want to run it and you don't wish to do any actual development.

To use docker, you can check out the images that are automatically built after each update to the `main` branch at
[ghcr](https://github.com/itsdrike/code-jam-2024/pkgs/container/code-jam-2024). You can also use [`docker
compose`](https://docs.docker.com/compose/) with the [`docker-compose.yaml`](./docker-compose.yaml) file, which will
pull this image from ghcr. To run the container using this file, you can use the following command:

```bash
docker compose up
```

> [!TIP]
> To run the container in the background, add the `-d` flag to the command.
If you want to build the image locally (to include some other changes that aren't yet in the main branch, maybe during
development or to customize something when deploying), you can also use
[`docker-compose.local.yaml`](./docker-compose.local.yaml), which defines an image building step from our
[`Dockerfile`](./Dockerfile). To run this local version of docker-compose, you can use the following command:

```bash
docker compose -f ./docker-compose.local.yaml up
```

> [!IMPORTANT]
> Note that you will still need to create a `.env` file with all of the configuration variables (see [the configuring
> section](#configuring-the-bot)
## Configuring the bot

The bot is configured using environment variables. You can either create a `.env` file and define these variables
Expand Down
9 changes: 9 additions & 0 deletions docker-compose.local.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "3.9"

services:
bot:
build:
context: .
dockerfile: Dockerfile
env_file:
- .env

0 comments on commit ab90638

Please sign in to comment.