Dockerfile
This commit is contained in:
parent
8bf5958883
commit
749b00878e
2 changed files with 24 additions and 0 deletions
22
Dockerfile
Normal file
22
Dockerfile
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
FROM python:3.12-slim
|
||||
|
||||
# Prevent Python from writing .pyc files and buffer stdout/stderr for clean logging
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies first to leverage Docker layer caching
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy application source code
|
||||
COPY matrix_keycloak_bot.py .
|
||||
|
||||
# Security best practice: run as a non-root user
|
||||
RUN useradd -m -u 10001 botuser && \
|
||||
chown -R botuser:botuser /app
|
||||
|
||||
USER botuser
|
||||
|
||||
CMD ["python", "matrix_keycloak_bot.py"]
|
||||
2
requirements.txt
Normal file
2
requirements.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
matrix-nio>=0.24.0
|
||||
python-keycloak>=4.0.0
|
||||
Loading…
Add table
Reference in a new issue