-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add `python 3.10` to tests matrix ci: remove `graalpy-23.1` from tests matrix ci(deps): downgrade `codecov/codecov-action` github actions to `v3.1.5` fix: support `HEAD` method for `/health` route
- Loading branch information
Showing
4 changed files
with
60 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
FROM pypy:3.10-slim@sha256:e074587f4ae78a735969c2fdedeacf2905c6116e8daefddabe18726ffc273327 as base | ||
LABEL maintainer "DeadNews <[email protected]>" | ||
|
||
ENV PIP_DEFAULT_TIMEOUT=100 \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=1 \ | ||
# Avoid to write .pyc files. | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
# Allow messages to immediately appear. | ||
PYTHONUNBUFFERED=1 \ | ||
# Tracebacks on segfaults. | ||
PYTHONFAULTHANDLER=1 | ||
|
||
WORKDIR /app | ||
|
||
FROM base as py-builder | ||
|
||
# renovate: datasource=pypi dep_name=poetry | ||
ENV POETRY_VERSION="1.7.1" | ||
ENV POETRY_VIRTUALENVS_IN_PROJECT=1 \ | ||
# Disable the dynamic versioning. | ||
POETRY_DYNAMIC_VERSIONING_COMMANDS="" \ | ||
# Maunt as dedicated RUN cache. | ||
POETRY_CACHE_DIR="/cache/poetry" \ | ||
PIP_CACHE_DIR="/cache/pip" | ||
|
||
RUN --mount=type=cache,target=${PIP_CACHE_DIR} \ | ||
pip install "poetry==${POETRY_VERSION}" | ||
|
||
# hadolint ignore=DL3008 | ||
RUN --mount=type=cache,target="/var/cache/" \ | ||
--mount=type=cache,target="/var/lib/apt/lists/" \ | ||
apt-get update && apt-get install --no-install-recommends -y gcc | ||
|
||
COPY pyproject.toml poetry.lock README.md src ./ | ||
RUN --mount=type=cache,target=${POETRY_CACHE_DIR} \ | ||
poetry install --only=main --no-root && \ | ||
poetry build | ||
|
||
FROM base as runtime | ||
|
||
ENV UVICORN_PORT=8000 \ | ||
UVICORN_HOST=0.0.0.0 \ | ||
PATH="/app/.venv/bin/:$PATH" | ||
|
||
COPY --from=py-builder /app/.venv /app/.venv | ||
COPY --from=py-builder /app/dist/*.whl /app/ | ||
|
||
RUN pip install /app/*.whl | ||
|
||
USER nobody:nogroup | ||
EXPOSE ${UVICORN_PORT} | ||
HEALTHCHECK --interval=60s --timeout=3s \ | ||
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:${UVICORN_PORT}/health || exit 1 | ||
|
||
CMD [ "python", "-m", "uvicorn", "deadnews_template_python.app:app" ] |
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