2025-08-18 09:10:42 +00:00
|
|
|
FROM python:3.13.7-slim
|
2018-02-11 23:03:19 +01:00
|
|
|
|
2024-12-31 12:36:35 +01:00
|
|
|
LABEL org.opencontainers.image.source="https://github.com/TeamNewPipe/web-api"
|
|
|
|
|
2018-02-11 23:03:19 +01:00
|
|
|
MAINTAINER "TheAssassin <theassassin@assassinate-you.net>"
|
|
|
|
|
2021-01-09 14:15:00 +01:00
|
|
|
# this port won't ever change, really
|
|
|
|
EXPOSE 5000
|
|
|
|
|
2018-02-11 23:03:19 +01:00
|
|
|
# create non-root user
|
2024-05-17 23:30:22 +02:00
|
|
|
RUN adduser app
|
2018-02-11 23:03:19 +01:00
|
|
|
|
|
|
|
USER app
|
2021-01-09 14:15:00 +01:00
|
|
|
WORKDIR /app
|
2018-02-11 23:03:19 +01:00
|
|
|
|
2024-05-17 23:30:22 +02:00
|
|
|
COPY README.md pyproject.toml poetry.lock /app/
|
|
|
|
COPY np_web_api/ /app/np_web_api/
|
2018-05-24 12:32:49 +02:00
|
|
|
|
2021-01-09 14:15:00 +01:00
|
|
|
# note: pip doesn't support editable (-e) installs with pyproject.toml only
|
2024-05-17 23:30:22 +02:00
|
|
|
RUN pip install .
|
2021-01-09 14:15:00 +01:00
|
|
|
|
2021-01-21 14:04:14 +01:00
|
|
|
HEALTHCHECK --interval=5m --timeout=15s \
|
2021-01-09 14:15:00 +01:00
|
|
|
CMD curl -f http://localhost:5000/data.json || exit 1
|
2018-02-11 23:03:19 +01:00
|
|
|
|
2021-01-09 14:15:00 +01:00
|
|
|
# using just one worker worked fine so far, and allows for some very crappy "synchronization" between requests by just
|
|
|
|
# using global variables, which help prevent concurrent requests to update cached data
|
2024-05-17 23:30:22 +02:00
|
|
|
CMD ["python", "-m", "uvicorn", "np_web_api.asgi:app", "--host", "0.0.0.0", "--port", "5000", "--workers", "1", "--no-access-log"]
|