Skip to content

Commit 65629f4

Browse files
committed
build: support uv.lock
1 parent 4534d9e commit 65629f4

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

Dockerfile

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,39 @@
11
FROM python:3.11-slim AS base_image
22

33
FROM base_image AS builder
4-
RUN apt update -y && apt install -y npm
5-
RUN python -m pip install pip --upgrade && \
6-
pip install --upgrade setuptools && \
7-
pip install wheel build
4+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
5+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
6+
apt update -y && apt install --no-install-recommends -y npm
87
COPY getmarcapi /src/getmarcapi/
98
COPY src /src/src/
10-
COPY pyproject.toml README.rst README.md setup.py MANIFEST.in requirements.txt /src/
119
WORKDIR /src
1210
COPY package.json package-lock.json webpack.config.js ./
13-
RUN npm install
11+
RUN --mount=type=cache,target=/root/.npm npm install
12+
RUN npm run env -- webpack --output-path=/output
1413

14+
#
1515
ARG PIP_INDEX_URL
1616
ARG PIP_EXTRA_INDEX_URL
17-
COPY requirements.txt ./requirements.txt
18-
RUN pip wheel --wheel-dir=/wheels -r /src/requirements.txt
19-
RUN python -m build --wheel --outdir /wheels
17+
COPY pyproject.toml uv.lock README.rst README.md setup.py MANIFEST.in /src/
18+
RUN python -m pip install --disable-pip-version-check uv && \
19+
uv build --wheel --out-dir /wheels
2020

2121
FROM base_image
22-
2322
COPY --from=builder /wheels/*.whl /wheels/
24-
COPY requirements.txt ./requirements.txt
25-
RUN pip install --find-links=/wheels --no-index -r requirements.txt
26-
RUN pip install --find-links=/wheels --no-index getmarcapi
27-
EXPOSE 5000
2823
WORKDIR /app
24+
COPY pyproject.toml uv.lock README.rst /app/
25+
ARG PIP_INDEX_URL
26+
ARG UV_INDEX_URL
27+
ARG UV_CACHE_DIR=/.cache/uv
28+
ARG UV_EXTRA_INDEX_URL
29+
RUN --mount=type=cache,target=${UV_CACHE_DIR} \
30+
python -m venv uv && \
31+
./uv/bin/pip install --disable-pip-version-check uv && \
32+
./uv/bin/uv sync --group deploy --no-dev --no-editable --no-install-project --find-links=/wheels && \
33+
./uv/bin/uv pip install --find-links=/wheels --no-index getmarcapi --no-deps
34+
EXPOSE 5000
2935
COPY api.cfg /app/settings.cfg
3036
ENV GETMARCAPI_SETTINGS=/app/settings.cfg
31-
RUN python -m getmarcapi --check
32-
CMD gunicorn getmarcapi.app:app --bind 0.0.0.0:5000 --log-level=debug
37+
RUN ./.venv/bin/python -m getmarcapi --check
38+
CMD ./.venv/bin/gunicorn getmarcapi.app:app --bind 0.0.0.0:5000 --log-level=debug
3339

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies = [
1212
]
1313
requires-python = ">= 3.9"
1414
readme = "README.rst"
15-
license = {text = "University of Illinois/NCSA Open Source License"}
15+
license = "NCSA"
1616
authors = [
1717
{name = "University Library at The University of Illinois at Urbana Champaign: Preservation Services", email = "[email protected]"},
1818
]

0 commit comments

Comments
 (0)