yt-dlp-aas/Dockerfile
Jack Jackson 0a2da8eb51 Add tests
This uses the `docker compose run --rm` approach suggested by Dudo
[here](https://github.com/orgs/gitops-ci-cd/discussions/1). I'm...still
learning my around it. It has some learning curve - especially regarding
running integration tests (the current setup _keeps_ the app running
even after tests have terminated, which is probably not as-desired), but
I suspect it'll become second-nature pretty quickly and will have
outsized benefits when working in a team with heterogeneous workstation
setups.
2025-02-02 20:05:42 -08:00

38 lines
924 B
Docker

# syntax=docker.io/docker/dockerfile:1.7-labs
FROM python:3.13 AS deps
WORKDIR /usr/src/app
COPY dev-requirements.txt ./
RUN pip install --no-cache-dir -r dev-requirements.txt
RUN rm dev-requirements.txt
#=======================================================
FROM deps AS app
WORKDIR /usr/src/app
RUN apt-get update && apt-get install -y ffmpeg
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
RUN rm requirements.txt
COPY --exclude=test_*.py src ./src
# Thanks to https://stackoverflow.com/questions/64776990/python-docker-no-module-found
ENV PYTHONPATH /usr/src/app
EXPOSE 8000
ENTRYPOINT ["python"]
CMD ["src/main.py"]
#=======================================================
FROM deps AS test
COPY dev-requirements.txt ./
RUN pip install --no-cache-dir -r dev-requirements.txt
COPY . .
# No `CMD`, because there are plenty of potential test commands, no single sensible default.