-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (44 loc) · 1.87 KB
/
Dockerfile
File metadata and controls
56 lines (44 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# =============================================================================
# YouTube Python SDK — Multi-stage Dockerfile
# =============================================================================
#
# Stages:
# base — shared Python + system dependencies
# dev — development environment with all extras (tests, linting)
# prod — minimal runtime image for library consumers
#
# Build examples:
# docker build --target dev -t youtube-sdk:dev .
# docker build --target prod -t youtube-sdk:prod .
ARG PYTHON_VERSION=3.12
ARG DEBIAN_RELEASE=slim-bookworm
# -----------------------------------------------------------------------------
# Stage: base
# -----------------------------------------------------------------------------
FROM python:${PYTHON_VERSION}-${DEBIAN_RELEASE} AS base
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
WORKDIR /app
# Copy only the packaging metadata first to leverage Docker layer caching.
COPY pyproject.toml README.md LICENSE ./
COPY youtube/ ./youtube/
# -----------------------------------------------------------------------------
# Stage: dev
# -----------------------------------------------------------------------------
FROM base AS dev
# Install the package with development extras.
RUN pip install -e ".[dev]"
COPY tests/ ./tests/
# Default command runs the full test suite.
CMD ["pytest", "--tb=short", "-v"]
# -----------------------------------------------------------------------------
# Stage: prod
# -----------------------------------------------------------------------------
FROM base AS prod
# Install only the runtime dependencies.
RUN pip install .
# The SDK is a library — nothing to run by default.
# Override CMD in your own Dockerfile to use it.
CMD ["python", "-c", "import youtube; print(f'YouTube Python SDK v{youtube.__version__} ready.')"]