diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ee429ec --- /dev/null +++ b/.dockerignore @@ -0,0 +1,15 @@ +.git +.gitignore +downloads +__pycache__ +*.pyc +*.pyo +README.md +LICENSE +docker-compose.yml +Dockerfile +.dockerignore +.env +.env.* +.vscode +.idea diff --git a/Dockerfile b/Dockerfile index d3dfbe9..335a41c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,24 @@ FROM python:3.12-slim +ENV PYTHONUNBUFFERED=1 \ + PYTHONDONTWRITEBYTECODE=1 + RUN apt-get update && \ apt-get install -y --no-install-recommends ffmpeg && \ rm -rf /var/lib/apt/lists/* WORKDIR /app + COPY requirements.txt . -RUN pip install --no-cache-dir -r requirements.txt +RUN pip install --no-cache-dir -r requirements.txt gunicorn COPY . . +RUN useradd -m -u 1000 reclip && \ + mkdir -p /app/downloads && \ + chown -R reclip:reclip /app +USER reclip + EXPOSE 8899 -ENV HOST=0.0.0.0 -CMD ["python", "app.py"] + +CMD ["gunicorn", "-b", "0.0.0.0:8899", "-w", "1", "--threads", "4", "--timeout", "600", "--access-logfile", "-", "app:app"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..19404ec --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +services: + reclip: + build: . + image: reclip:latest + container_name: reclip + ports: + - "8899:8899" + volumes: + - reclip-downloads:/app/downloads + restart: unless-stopped + +volumes: + reclip-downloads: