API docs et Dockerfile for dev
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
env
|
||||
__pycache__
|
||||
.git
|
||||
.venv
|
||||
/*.pyc
|
||||
*.egg-info
|
||||
dist
|
||||
build
|
||||
@@ -0,0 +1,28 @@
|
||||
FROM python:3.9.2-slim
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
# Install minimal build deps (kept small). Adjust if your requirements need additional system packages.
|
||||
RUN sed -i 's|http://deb.debian.org/debian|http://archive.debian.org/debian|g' /etc/apt/sources.list \
|
||||
|| true \
|
||||
&& sed -i 's|http://security.debian.org/debian-security|http://archive.debian.org/debian-security|g' /etc/apt/sources.list \
|
||||
|| true \
|
||||
&& echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid-until \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends gcc ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy only requirements first to leverage Docker cache
|
||||
COPY requirements.txt /app/requirements.txt
|
||||
|
||||
RUN pip install --upgrade pip \
|
||||
&& pip install --no-cache-dir -r /app/requirements.txt
|
||||
|
||||
# By default the container runs Python; pass a script name or `-m` args after the image name.
|
||||
ENTRYPOINT ["python3"]
|
||||
|
||||
# Recommended working directory for runs
|
||||
CMD ["-V"]
|
||||
@@ -0,0 +1,38 @@
|
||||
Image Docker de développement pour exécuter les scripts Python du projet
|
||||
|
||||
This image provides a lightweight Python 3.9.2 environment with the project `requirements.txt` installed.
|
||||
|
||||
Build
|
||||
-----
|
||||
|
||||
From the repository root (where `requirements.txt` sits) run:
|
||||
|
||||
```bash
|
||||
docker build -t cal-to-time-manager:dev -f support/docker-dev/Dockerfile .
|
||||
```
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Run a script from the project root by mounting the repo into `/app`:
|
||||
|
||||
```bash
|
||||
# run csv-to-timemanager.py
|
||||
docker run --rm -v "$(pwd)":/app -w /app cal-to-time-manager:dev csv-to-timemanager.py
|
||||
|
||||
# run with arguments
|
||||
docker run --rm -v "$(pwd)":/app -w /app cal-to-time-manager:dev csv-to-timemanager.py arg1 arg2
|
||||
```
|
||||
|
||||
Open an interactive shell (override the image entrypoint):
|
||||
|
||||
```bash
|
||||
docker run --rm -it --entrypoint bash -v "$(pwd)":/app -w /app cal-to-time-manager:dev
|
||||
```
|
||||
|
||||
Notes
|
||||
-----
|
||||
- The container uses Python 3.9.2 (slim). If your `requirements.txt` needs system packages, adapt the `Dockerfile` to install them.
|
||||
- The scripts expect `config.json` and CSV files to be present in the mounted workspace path.
|
||||
- If your scripts connect to services (MySQL, Nextcloud API), ensure the container can reach those hosts (network, VPN, or expose host ports).
|
||||
- To pass secret credentials, prefer using environment variables or Docker secrets rather than baking them in `config.json` inside the image.
|
||||
Reference in New Issue
Block a user