| |
|
|
| |
| FROM weishaw/sub2api:latest AS sub2api_bin |
|
|
| FROM debian:bookworm-slim |
|
|
| ENV DEBIAN_FRONTEND=noninteractive \ |
| LANG=C.UTF-8 \ |
| LC_ALL=C.UTF-8 \ |
| PYTHONDONTWRITEBYTECODE=1 \ |
| PYTHONUNBUFFERED=1 |
|
|
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| bash \ |
| ca-certificates \ |
| curl \ |
| procps \ |
| supervisor \ |
| redis-server \ |
| postgresql \ |
| postgresql-client \ |
| python3 \ |
| python3-pip \ |
| python3-venv \ |
| tini \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN useradd -m -u 1000 user |
|
|
| ENV HOME=/home/user \ |
| APP_HOME=/app \ |
| PGDATA=/app/pgdata \ |
| REDIS_DIR=/app/redis \ |
| SUB2API_DATA_DIR=/app/data \ |
| VENV_PATH=/app/venv \ |
| PATH=/app/venv/bin:/home/user/.local/bin:$PATH |
|
|
| WORKDIR /app |
|
|
| COPY --from=sub2api_bin /app/sub2api /usr/local/bin/sub2api |
|
|
| COPY --chown=user:user start.sh /usr/local/bin/start.sh |
| COPY --chown=user:user supervisord.conf /etc/supervisor/conf.d/supervisord.conf |
| |
| COPY --chown=user:user backup_to_dataset.py /app/backup_to_dataset.py |
| COPY --chown=user:user backup_worker.sh /usr/local/bin/backup_worker.sh |
| COPY --chown=user:user requirements.txt /app/requirements.txt |
| |
| COPY --chown=user:user config.override.yaml /app/config.override.yaml |
|
|
| COPY --chown=user:user backup_to_dataset.py /app/backup_to_dataset.py |
| COPY --chown=user:user restore_from_dataset.py /app/restore_from_dataset.py |
| COPY --chown=user:user backup_worker.sh /usr/local/bin/backup_worker.sh |
| COPY --chown=user:user requirements.txt /app/requirements.txt |
|
|
| RUN chmod +x /usr/local/bin/backup_worker.sh |
| |
| RUN chmod +x /usr/local/bin/start.sh /usr/local/bin/backup_worker.sh \ |
| && mkdir -p /app /app/data /app/data/logs /app/data/sora /app/pgdata /app/redis /app/venv /var/log/supervisor \ |
| && chown -R user:user /app /var/log/supervisor \ |
| && python3 -m venv /app/venv \ |
| && /app/venv/bin/pip install --no-cache-dir --upgrade pip setuptools wheel \ |
| && /app/venv/bin/pip install --no-cache-dir -r /app/requirements.txt |
| |
|
|
| RUN chmod +x /usr/local/bin/start.sh \ |
| && mkdir -p /app /app/data /app/data/logs /app/data/sora /app/pgdata /app/redis /app/venv /var/log/supervisor \ |
| && chown -R user:user /app /var/log/supervisor \ |
| && python3 -m venv /app/venv \ |
| && /app/venv/bin/pip install --no-cache-dir --upgrade pip setuptools wheel |
|
|
| EXPOSE 8080 |
|
|
| USER user |
| ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/start.sh"] |