Skip to content

Commit

Permalink
use uv in the Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
hrodmn committed Oct 17, 2024
1 parent d2a898a commit 8595159
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
14 changes: 6 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
ARG PYTHON_VERSION=3.11
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim

WORKDIR /app

FROM python:${PYTHON_VERSION}-slim

WORKDIR /tmp
COPY pyproject.toml pyproject.toml
COPY uv.lock uv.lock

COPY titiler/ titiler/
COPY pyproject.toml pyproject.toml
COPY README.md README.md
COPY LICENSE LICENSE

RUN pip install --no-cache-dir --upgrade . uvicorn
RUN rm -rf titiler/ pyproject.toml README.md LICENSE
RUN uv sync --frozen --extra uvicorn

ARG EARTHDATA_USERNAME
ARG EARTHDATA_PASSWORD
Expand All @@ -28,5 +26,5 @@ RUN if [ -z "$EARTHDATA_USERNAME" ] || [ -z "$EARTHDATA_PASSWORD" ]; then \
# http://www.uvicorn.org/settings/
ENV HOST 0.0.0.0
ENV PORT 80
CMD uvicorn titiler.cmr.main:app --host ${HOST} --port ${PORT} --log-level debug
CMD uv run uvicorn titiler.cmr.main:app --host ${HOST} --port ${PORT} --log-level debug

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ dependencies = [
dynamic = ["version"]

[project.optional-dependencies]
uvicorn = [
"uvicorn",
]
dev = [
"pre-commit",
"jupyterlab>=4.2.5",
Expand Down
20 changes: 19 additions & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8595159

Please sign in to comment.