feat: docker
This commit is contained in:
1 parent
86d660acba
commit
f1a26d80a8
4 files changed
+47
-1
No files matched your search
@@ -0,0 +1,13 @@
|
||||
# secrets - never bake the bot token into the image
|
||||
config.ini
|
||||
|
||||
# local junk
|
||||
.venv
|
||||
.git
|
||||
.gitignore
|
||||
__pycache__
|
||||
*.pyc
|
||||
readme/
|
||||
.dockerignore
|
||||
Dockerfile
|
||||
docker-compose.yml
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
FROM ghcr.io/astral-sh/uv:python3.14-bookworm-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Force uv to use the system Python instead of downloading its own
|
||||
ENV UV_PYTHON_DOWNLOADS=never \
|
||||
UV_COMPILE_BYTECODE=1 \
|
||||
UV_LINK_MODE=copy \
|
||||
PYTHONUNBUFFERED=1
|
||||
|
||||
# Install locked dependencies first so code changes don't invalidate this layer
|
||||
COPY pyproject.toml uv.lock ./
|
||||
RUN uv sync --frozen --no-dev
|
||||
|
||||
# Then copy the application itself
|
||||
COPY main.py formater.py image.py ./
|
||||
COPY assets ./assets
|
||||
|
||||
# Put the venv on PATH so `python` resolves to the venv interpreter
|
||||
ENV PATH="/app/.venv/bin:$PATH"
|
||||
|
||||
CMD ["python", "main.py"]
|
||||
@@ -0,0 +1,11 @@
|
||||
services:
|
||||
bot:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: confucius-quote-bot
|
||||
environment:
|
||||
- PYTHONUNBUFFERED=1
|
||||
volumes:
|
||||
- ./config.ini:/app/config.ini:ro
|
||||
restart: unless-stopped
|
||||
Reference in new issue
Block a user