fix docker implementation

This commit is contained in:
2025-07-20 18:28:26 +00:00
parent 5185f2d9fd
commit a5bf821186
12 changed files with 112 additions and 77 deletions

View File

@@ -5,14 +5,15 @@ for e-ink displays, and uploads them to a e-ink screens running on the
[Waveshare E-Paper ESP32 Driver
Board](https://www.waveshare.com/wiki/E-Paper_ESP32_Driver_Board).
![Picture of e-ink screen](https://gitea.bubbletea.dev/shibao/szuru-eink-bot/raw/branch/master/eink-screen.jpg)
![Picture of e-ink
screen](https://gitea.bubbletea.dev/shibao/szuru-eink-bot/raw/branch/master/eink-screen.jpg)
## Features
- Fetches random images from a configurable Szurubooru instance.
- Resizes and dithered images for e-ink display compatibility.
- Supports monochrome and color dithering (for compatible displays).
- Uploads processed images to a Waveshare 7.5b V2 e-ink screen.
- Uploads processed images to a Waveshare e-ink screen.
- Configurable via environment variables.
- Designed to run as a Docker container on a cron job.
@@ -35,9 +36,8 @@ cd szuru-eink
### 2. Configure Environment Variables
Create a `.env` file in the root directory of the project (if it doesn't exist)
and populate it with your Szurubooru API details and e-ink screen configuration.
You can use the `.env.sample` as a reference for the required variables.
Modify `docker-compose.yml` with the environment variables specified for your
display.
**Note:** For `EPD_TYPE`, refer to the `epd/epd_config.py` file for a full list
of supported display types and their corresponding string labels. For color
@@ -55,32 +55,24 @@ docker-compose up --build -d
This command will:
- Build the Docker image based on the `Dockerfile`.
- Create and start a Docker container named `szuru-eink-bot`.
- Copy the environment variables from your `.env` file to `docker-compose.yml`
for the container.
- Configure the environment variables in `docker-compose.yml` for the container.
- Set up a cron job inside the container to run the `szuru-eink.py` script at a
specified interval (default: every 15 minutes).
- Create a bind mount for logs in `./logs` directory on your host machine.
### 4. Verify Logs
You can check the logs generated by the cron job in the
`./logs/szuru-eink-cron.log` file on your host machine.
```bash
tail -f logs/szuru-eink-cron.log
```
You can check the logs by doing `docker-compose logs -f szuru-eink-bot`.
## Project Structure
```
.dockerignore
.env
.gitignore
.tool-versions
Dockerfile
README.md
crontab
cron_job.sh
entrypoint.sh
docker-compose.yml
epd/
├── epd_config.py
@@ -94,7 +86,6 @@ szuru-eink.py
- `uv` (for dependency management)
- `Pillow` (for image processing)
- `python-dotenv` (for loading environment variables in local testing)
- `pyszuru` (for interacting with Szurubooru API)
- `requests` (for HTTP requests)
- `black` (development dependency for code formatting)
@@ -110,8 +101,16 @@ is not guaranteed without further testing and potential adjustments to
### Driver Board and Flashing
The e-ink screen used in this project is driven by the [Waveshare E-Paper ESP32 Driver Board](https://www.waveshare.com/wiki/E-Paper_ESP32_Driver_Board). The board was flashed with the sample `Loader_esp32wf` project provided by Waveshare, which exposes the web interface that this Python script interacts with.
The e-ink screen used in this project is driven by the [Waveshare E-Paper ESP32
Driver Board](https://www.waveshare.com/wiki/E-Paper_ESP32_Driver_Board). The
board was flashed with the sample `Loader_esp32wf` project provided by
Waveshare, which exposes the web interface that this Python script interacts
with.
### 3D Printed Casing
The 3D printed casing for the e-ink screen shown in the preview image was sourced from [lmarzen/esp32-weather-epd](https://github.com/lmarzen/esp32-weather-epd). I covered it in walnut because I like walnut, sourced from [Amazon](https://www.amazon.com/dp/B08SVQBVJN).
The 3D printed casing for the e-ink screen shown in the preview image was
sourced from
[lmarzen/esp32-weather-epd](https://github.com/lmarzen/esp32-weather-epd). I
covered it in walnut because I like walnut, sourced from
[Amazon](https://www.amazon.com/dp/B08SVQBVJN).