-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
85 lines (65 loc) · 2.77 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
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
#--- BEGIN Usual Python stuff ---
FROM ghcr.io/valhalla/valhalla:latest as builder
LABEL maintainer=nils@gis-ops.com
WORKDIR /app
# Install vis
RUN apt-get update -y > /dev/null && \
apt-get install -y \
apt-transport-https \
ca-certificates \
python-is-python3 \
python3-pip \
python3-venv \
curl > /dev/null && \
python -m pip install --upgrade pip --break-system-packages
ENV POETRY_BIN /root/.local/bin/poetry
RUN curl -sSL https://install.python-poetry.org | python && \
$POETRY_BIN config virtualenvs.create false && \
$POETRY_BIN config virtualenvs.in-project true && \
python -m venv app_venv
# Copy these first so no need to re-install only bcs source code changes
COPY pyproject.toml .
COPY poetry.lock .
# Install dependencies.py only
RUN . app_venv/bin/activate && \
$POETRY_BIN install --no-interaction --no-ansi --no-root --only main
COPY . .
# Install dependencies.py and remove unneeded stuff
RUN . app_venv/bin/activate && \
$POETRY_BIN install --no-interaction --no-ansi --only main && \
mkdir -p /app/data
# Do some Valhalla stuff
# remove some stuff from the original image
RUN cd /usr/local/bin && \
preserve="valhalla_service valhalla_build_tiles valhalla_build_config valhalla_build_admins valhalla_build_timezones valhalla_build_elevation valhalla_ways_to_edges valhalla_build_extract valhalla_export_edges valhalla_add_predicted_traffic" && \
mv $preserve .. && \
for f in valhalla*; do rm $f; done && \
cd .. && mv $preserve ./bin
FROM ubuntu:23.04 as runner_base
MAINTAINER Nils Nolde <nils@gis-ops.com>
# install Valhalla stuff
RUN apt-get update > /dev/null && \
export DEBIAN_FRONTEND=noninteractive && \
apt-get install -y libluajit-5.1-2 \
libzmq5 libgdal-dev libczmq4 spatialite-bin libprotobuf-lite32 sudo locales wget \
libsqlite3-0 libsqlite3-mod-spatialite libcurl4 python-is-python3 osmctools \
python3.11-minimal python3-distutils curl unzip moreutils jq spatialite-bin supervisor > /dev/null
WORKDIR /app
ENV LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}"
# export the True defaults
ENV use_tiles_ignore_pbf=True
ENV build_tar=True
ENV serve_tiles=True
COPY . .
COPY --from=builder /usr/local /usr/local
COPY --from=builder /app/app_venv /app/app_venv
COPY --from=builder /app/scripts/* /usr/local/bin/
COPY --from=builder /app/conf/* /etc/supervisor/conf.d/
# add the root cert for https://ftp5.gwdg.de/pub/misc/openstreetmap/planet.openstreetmap.org/, so osmupdate can download stuff
RUN mv /app/ssl/gwdg_root_cert.crt /usr/local/share/ca-certificates && \
update-ca-certificates
EXPOSE 5000
HEALTHCHECK --start-period=5s CMD curl --fail -s http://localhost:5000/api/v1/jobs || exit 1
# Start gunicorn
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["app"]