-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
94 lines (89 loc) · 2.61 KB
/
Copy pathDockerfile
File metadata and controls
94 lines (89 loc) · 2.61 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
FROM python:3.13.9-slim-trixie AS base
FROM base AS osm2pgrouting3
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
cmake \
expat \
git \
libboost-dev \
libboost-program-options-dev \
libexpat1-dev \
libpqxx-dev
WORKDIR /usr/src/
RUN git clone https://github.com/pgRouting/osm2pgrouting.git \
&& cd osm2pgrouting \
&& cmake -H. -Bbuild \
&& cd build/ \
&& make
FROM base AS builder
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
curl \
g++ \
gcc \
gdal-bin \
libgdal-dev \
proj-bin \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR /usr/src/app
COPY . .
RUN pip install uv \
&& uv export --format requirements-txt --all-extras --no-group dev --no-hashes -o requirements.txt \
&& mkdir -p deps \
&& pip wheel -r requirements.txt -w deps \
&& uv build --wheel
FROM base AS main
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 \
libpqxx-7.10 \
osm2pgsql \
osmctools \
osmium-tool \
postgis \
postgresql-client-17 \
proj-bin \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV BNA_OSMNX_CACHE=0
ENV BNA_PYGRIS_CACHE=0
WORKDIR /usr/src/app
COPY --from=builder /usr/src/app/deps ./pkg/deps
COPY --from=builder /usr/src/app/dist ./pkg/dist
COPY --from=osm2pgrouting3 /usr/src/osm2pgrouting/build/osm2pgrouting /usr/bin/osm2pgrouting
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
ENTRYPOINT [ "bna" ]
FROM main AS dev
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \
gcc \
git \
graphviz \
just \
locales \
npm \
openssh-client \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN deluser --remove-home bna \
&& delgroup --only-if-empty bna \
&& chown -R root:root /usr/src/app \
&& pip install uv \
&& useradd --create-home --shell /bin/bash bna
RUN curl -o /etc/bash_completion.d/git-completion.bash \
https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
USER bna
FROM main
USER bna