Skip to content

Commit 301b98a

Browse files
committed
Ignore hashes for local packages
1 parent 044d433 commit 301b98a

File tree

6 files changed

+40
-22
lines changed

6 files changed

+40
-22
lines changed

services/legacy-tileserver/Dockerfile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,26 +59,30 @@ WORKDIR /app/
5959
# Copy only requirements to cache them in docker layer
6060
# Right now, Poetry lock file must exist to avoid hanging on dependency resolution
6161
COPY ./pyproject.toml ./poetry.lock /app/
62-
# This gets locally built deps, which must be staged in the
63-
# image directory before building. This is breakable and we'd like
64-
# to end up with a better solution eventually.
65-
COPY ./deps/ /app/deps/
6662

6763
# Create and activate our own virtual envrionment so that we can keep
6864
# our application dependencies separate from Poetry's
6965
RUN python3 -m venv /venv
7066
ENV PATH="/venv/bin:$PATH"
67+
ENV VIRTUAL_ENV=/venv
7168

72-
RUN --mount=type=cache,target=$POETRY_CACHE_DIR poetry install --no-root --without dev
69+
RUN --mount=type=cache,target=$POETRY_CACHE_DIR poetry install --no-root --without dev --without local
7370

74-
EXPOSE 8000
71+
# This gets locally built deps, which must be staged in the
72+
# image directory before building. This is breakable and we'd like
73+
# to end up with a better solution eventually.
74+
COPY ./deps/ /app/deps/
75+
76+
# Install local wheels without caring about hashes (poetry gets mad if package hashes don't match.)
77+
RUN pip install --no-cache-dir ./deps/*.whl
7578

7679
# Creating folders, and files for a project:
7780
COPY ./ /app/
7881

7982
# Install the root package
8083
RUN --mount=type=cache,target=$POETRY_CACHE_DIR poetry install --without dev
8184

85+
EXPOSE 8000
8286

8387
CMD ["uvicorn", "--host", "0.0.0.0", "--port", "8000", "macrostrat.legacy_tileserver:app"]
8488

services/legacy-tileserver/poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

services/legacy-tileserver/pyproject.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,20 @@ asyncpg = "^0.23.0"
1616
buildpg = "^0.4"
1717
morecantile = "^6.2.0"
1818
"macrostrat.utils" = "^1.2.0"
19+
"macrostrat.database" = "^3.0.0"
20+
21+
[tool.poetry.group.local.dependencies]
1922
# Local wheel of macrostrat.tileserver-utils. This must be built (using make in the py-modules directory)
2023
# and copied here before Docker build.
2124
"macrostrat.tileserver-utils" = { file = "deps/macrostrat_tileserver_utils-0.1.0-py3-none-any.whl" }
22-
"macrostrat.database" = "^3.0.0"
23-
# NOTE: there is also a requirement on mapnik, but this cannot be installed via poetry
24-
# due to its complicated installation process.
2525

2626
[tool.poetry.group.dev.dependencies]
2727
isort = "^5.12.0"
2828
black = "^24.8.0"
29+
# NOTE: there is also a requirement on mapnik, but this cannot be installed via poetry
30+
# due to its complicated installation process.
31+
# mapnik = "^3.0.0"
32+
2933

3034
[build-system]
3135
build-backend = "poetry.core.masonry.api"

services/tileserver/Dockerfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ ENV PATH="/venv/bin:$PATH" \
3535
WORKDIR /app/
3636

3737
COPY pyproject.toml poetry.lock ./
38+
COPY ./deps/timvt ./deps/timvt
3839
RUN touch README.md
3940

4041
# Install Poetry dependencies (without dev and local dependencies)
@@ -48,7 +49,16 @@ RUN apt-get remove -y \
4849
python3.11-dev && \
4950
rm -rf /var/lib/apt/lists/*
5051

51-
# Creating folders and files for a project, including local dependencies
52+
# Copy local wheels and install with pip
53+
# TODO: place these wheels in a package repository to separate their build process...
54+
COPY ./deps/*.whl ./deps/
55+
# Install local wheels without caring about hashes (poetry gets mad if package hashes don't match.
56+
# Non-matching hashes could result from a different build environment (e.g, the wheel was compiled/locked locally
57+
# and the Dockerfile is now being built in CI/CD).
58+
# This is a temporary solution until we can get the wheels into a package repository.
59+
RUN pip install --no-cache-dir ./deps/*.whl
60+
61+
# Creating folders and files for a project, including remaining local wheels
5262
COPY ./ /app/
5363

5464
# Install the root project and local dependencies

services/tileserver/poetry.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

services/tileserver/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ uvicorn = "^0.34.2"
1717
titiler = "^0.18.5"
1818
httpx = "^0.27.2"
1919
mapbox-vector-tile = "^2.1.0"
20+
timvt = { path = "./deps/timvt", develop = true }
2021

2122
[tool.poetry.group.local.dependencies]
22-
timvt = { path = "./deps/timvt", develop = true }
2323
# Local wheel of macrostrat.tileserver-utils. This must be built (using make in the py-modules directory)
2424
# and copied here before Docker build.
2525
"macrostrat.tileserver-utils" = { file = "./deps/macrostrat_tileserver_utils-0.1.0-py3-none-any.whl" }

0 commit comments

Comments
 (0)