-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
49 lines (47 loc) · 1.47 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
FROM python:3.12.4-slim-bookworm AS base
FROM base AS builder
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
gcc \
g++ \
gdal-bin \
libgdal-dev \
python3-dev \
python3-poetry \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR /usr/src/app
COPY . .
RUN poetry self update \
&& poetry export -f requirements.txt --output requirements.txt \
&& mkdir -p deps \
&& pip wheel -r requirements.txt -w deps \
&& poetry build -f wheel
FROM base
LABEL author="PeopleForBikes" \
maintainer="BNA Mechanics - https://peopleforbikes.github.io" \
org.opencontainers.image.description="Run a BNA analysis locally." \
org.opencontainers.image.source="https://github.com/PeopleForBikes/brokenspoke-analyzer"
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
gdal-bin \
osm2pgrouting \
osm2pgsql \
osmctools \
osmium-tool \
postgresql-client-15 \
postgis \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV BNA_OSMNX_CACHE=0
WORKDIR /usr/src/app
COPY --from=builder /usr/src/app/deps ./pkg/deps
COPY --from=builder /usr/src/app/dist ./pkg/dist
RUN pip install pkg/deps/* \
&& pip install pkg/dist/brokenspoke_analyzer-*-py3-none-any.whl \
&& rm -fr /usr/src/app/pkg \
&& addgroup --system --gid 1001 bna \
&& adduser --system --uid 1001 bna \
&& chown -R bna:bna /usr/src/app
USER bna
ENTRYPOINT [ "bna" ]