dockerize
This commit is contained in:
6
.dockerignore
Normal file
6
.dockerignore
Normal file
@@ -0,0 +1,6 @@
|
||||
*.env
|
||||
.venv
|
||||
image.jpg
|
||||
processed.png
|
||||
interface/
|
||||
__pycache__/
|
28
Dockerfile
Normal file
28
Dockerfile
Normal file
@@ -0,0 +1,28 @@
|
||||
# Use a lightweight Python base image
|
||||
FROM python:3.13-slim-bookworm
|
||||
|
||||
# Set the working directory in the container
|
||||
WORKDIR /app
|
||||
|
||||
# Install uv and dependencies
|
||||
COPY pyproject.toml ./
|
||||
RUN apt-get update && apt-get install -y cron \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN pip install uv && uv sync
|
||||
|
||||
# Copy the application code
|
||||
COPY szuru-eink.py ./
|
||||
COPY epd/ ./epd/
|
||||
|
||||
# Copy the cron job script and crontab file
|
||||
COPY cron_job.sh /usr/local/bin/cron_job.sh
|
||||
COPY crontab /etc/cron.d/szuru-eink-cron
|
||||
|
||||
# Give execution rights on the cron job script
|
||||
RUN chmod +x /usr/local/bin/cron_job.sh
|
||||
|
||||
# Apply cron job
|
||||
RUN crontab /etc/cron.d/szuru-eink-cron
|
||||
|
||||
# Run cron
|
||||
CMD ["cron", "-f"]
|
4
cron_job.sh
Normal file
4
cron_job.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Run the Python script using uv
|
||||
uv run /app/szuru-eink.py
|
1
crontab
Normal file
1
crontab
Normal file
@@ -0,0 +1 @@
|
||||
*/15 * * * * root /usr/local/bin/cron_job.sh >> /var/log/szuru-eink-cron.log 2>&1
|
15
docker-compose.yml
Normal file
15
docker-compose.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
szuru-eink-bot:
|
||||
build: .
|
||||
container_name: szuru-eink-bot
|
||||
environment:
|
||||
- SZURU_URL=YOUR_SZURU_URL
|
||||
- SZURU_USER=YOUR_SZURU_USER
|
||||
- SZURU_TOKEN=YOUR_SZURU_TOKEN
|
||||
- EPD_TYPE=YOUR_EPD_TYPE # e.g., '7.5 V2', 5.65f
|
||||
- EINK_IP=YOUR_EINK_IP
|
||||
- DITHERING_MODE=YOUR_DITHERING_MODE # e.g., mono, color
|
||||
volumes:
|
||||
- ./logs:/var/log'
|
Reference in New Issue
Block a user