-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
2,695 additions
and
597 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,62 @@ | ||
# syntax=docker/dockerfile:1.4 | ||
ARG PYTHON_IMAGE=python:3.12-slim-bookworm | ||
ARG PYTHON_IMAGE=ghcr.io/astral-sh/uv:python3.12-bookworm-slim | ||
|
||
# BUILD STAGE - Download dependencies from GitHub that require SSH access | ||
FROM $PYTHON_IMAGE as build | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y \ | ||
build-essential \ | ||
git \ | ||
libffi-dev \ | ||
libpq-dev \ | ||
curl | ||
|
||
COPY requirements.txt / | ||
WORKDIR /pip-packages/ | ||
RUN pip wheel -r /requirements.txt | ||
RUN rm -rf /pip-packages/src | ||
ENV UV_LINK_MODE=copy \ | ||
UV_COMPILE_BYTECODE=1 \ | ||
UV_PYTHON_DOWNLOADS=never \ | ||
UV_PYTHON=python \ | ||
UV_PROJECT_ENVIRONMENT=/worker | ||
|
||
# Then, add the rest of the project source code and install it | ||
# Installing separately from its dependencies allows optimal layer caching | ||
RUN --mount=type=cache,target=/root/.cache/uv \ | ||
--mount=type=bind,source=uv.lock,target=uv.lock \ | ||
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \ | ||
uv sync --frozen | ||
|
||
RUN --mount=type=cache,target=/root/.cache/uv \ | ||
--mount=type=bind,source=uv.lock,target=uv.lock \ | ||
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \ | ||
uv export --no-hashes --frozen --format requirements-txt > requirements.txt | ||
|
||
RUN grep -v '^-e ' requirements.txt > requirements.remote.txt | ||
|
||
# build all remote wheels | ||
RUN pip wheel -w wheels --find-links wheels -r requirements.remote.txt | ||
|
||
# build all local packages to wheels | ||
RUN --mount=type=cache,target=/root/.cache/uv \ | ||
--mount=type=bind,source=uv.lock,target=uv.lock \ | ||
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \ | ||
uv build --all-packages --wheel -o wheels | ||
|
||
# RUNTIME STAGE - Copy packages from build stage and install runtime dependencies | ||
FROM $PYTHON_IMAGE | ||
|
||
# Our postgres driver psycopg2 requires libpq-dev as a runtime dependency | ||
RUN apt-get update | ||
RUN apt-get install -y \ | ||
git \ | ||
libpq-dev \ | ||
make \ | ||
curl \ | ||
libexpat1 \ | ||
&& pip install --upgrade pip | ||
|
||
WORKDIR /pip-packages/ | ||
COPY --from=build /pip-packages/ /pip-packages/ | ||
COPY --from=build /wheels/ /wheels/ | ||
|
||
RUN pip install --no-deps --no-index --find-links=/pip-packages/ /pip-packages/* | ||
RUN --mount=type=cache,target=/root/.cache/uv \ | ||
--mount=type=bind,source=uv.lock,target=uv.lock \ | ||
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \ | ||
uv pip install --no-deps --no-index --find-links=wheels wheels/* --system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
[project] | ||
name = "api" | ||
version = "0.1.0" | ||
description = "Codecov's API layer" | ||
readme = "README.md" | ||
requires-python = ">=3.12" | ||
dependencies = [ | ||
"aiodataloader", | ||
"ariadne==0.23", | ||
"ariadne_django==0.3.0", | ||
"codecovopentelem", | ||
"celery>=5.3.6", | ||
"cerberus", | ||
"ddtrace", | ||
"Django>=4.2.16", | ||
"django-cors-headers", | ||
"django-csp", | ||
"django-dynamic-fixture", | ||
"django-filter", | ||
"django-model-utils", | ||
"django-postgres-extra>=2.0.8", | ||
"django-prometheus", | ||
"djangorestframework==3.15.2", | ||
"drf-spectacular", | ||
"drf-spectacular-sidecar", | ||
"elastic-apm", | ||
"google-cloud-pubsub", | ||
"gunicorn>=22.0.0", | ||
"idna>=3.7", | ||
"minio", | ||
"opentelemetry-instrumentation-django>=0.45b0", | ||
"opentelemetry-sdk>=1.24.0", | ||
"opentracing", | ||
"polars==1.12.0", | ||
"psycopg2", | ||
"PyJWT", | ||
"pydantic", | ||
"python-dateutil", | ||
"python-json-logger", | ||
"python-redis-lock", | ||
"pytz", | ||
"redis", | ||
"regex", | ||
"requests", | ||
"sentry-sdk>=2.13.0", | ||
"setproctitle", | ||
"shared", | ||
"simplejson", | ||
"starlette==0.40.0", | ||
"stripe>=9.6.0", | ||
"test-results-parser", | ||
"timestring", | ||
"urllib3>=1.26.19", | ||
"vcrpy", | ||
"whitenoise", | ||
"django-autocomplete-light", | ||
"django-better-admin-arrayfield", | ||
"certifi>=2024.07.04", | ||
] | ||
|
||
[build-system] | ||
requires = ["setuptools"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools] | ||
py-modules = [] | ||
|
||
[tool.uv] | ||
dev-dependencies = [ | ||
"factory-boy", | ||
"fakeredis", | ||
"freezegun", | ||
"pre-commit", | ||
"pytest>=7.2.0", | ||
"pytest-cov", | ||
"pytest-asyncio", | ||
"pytest-django", | ||
"pytest-mock", | ||
"vcrpy", | ||
] | ||
|
||
|
||
[tool.uv.sources] | ||
codecovopentelem = { git = "https://github.com/codecov/opentelem-python", rev = "df1e241927d4794fc0e24f96431f0fb730edac21" } | ||
shared = { git = "https://github.com/codecov/shared", rev = "9c31870de026a8a3f026f0753b1991e8c832fadb" } |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.