2021-11-14 22:42:02 +00:00
|
|
|
# This dockerfile is for the API + Frontend production image
|
|
|
|
|
2022-01-02 12:12:58 +00:00
|
|
|
#############################################
|
|
|
|
# Build osm2pgsql AS builder
|
|
|
|
#############################################
|
|
|
|
|
|
|
|
# This image should be the same as final one, because of the lib versions
|
|
|
|
FROM python:3.9.7-bullseye as osm2pgsql-builder
|
|
|
|
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
ENV TZ=Europe/Berlin
|
|
|
|
ENV OSM2PGSQL_VERSION=1.5.1
|
|
|
|
|
|
|
|
# Dependencies
|
|
|
|
RUN apt-get update &&\
|
|
|
|
apt-get install -y \
|
|
|
|
make \
|
|
|
|
cmake \
|
|
|
|
g++ \
|
|
|
|
libboost-dev \
|
|
|
|
libboost-system-dev \
|
|
|
|
libboost-filesystem-dev \
|
|
|
|
libexpat1-dev \
|
|
|
|
zlib1g-dev \
|
|
|
|
libbz2-dev \
|
|
|
|
libpq-dev \
|
|
|
|
libproj-dev \
|
|
|
|
lua5.3 \
|
|
|
|
liblua5.3-dev \
|
|
|
|
git &&\
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
# Clone & Build
|
|
|
|
RUN git clone --branch $OSM2PGSQL_VERSION git://github.com/openstreetmap/osm2pgsql.git &&\
|
|
|
|
cd osm2pgsql/ &&\
|
|
|
|
mkdir build &&\
|
|
|
|
cd build &&\
|
|
|
|
cmake .. &&\
|
2022-03-14 18:05:47 +00:00
|
|
|
make -j4 &&\
|
2022-01-02 12:12:58 +00:00
|
|
|
make install
|
|
|
|
|
2021-11-14 22:42:02 +00:00
|
|
|
#############################################
|
|
|
|
# Build the frontend AS builder
|
|
|
|
#############################################
|
|
|
|
|
2021-11-25 19:13:10 +00:00
|
|
|
FROM node:17 as frontend-builder
|
2021-11-14 22:42:02 +00:00
|
|
|
|
|
|
|
WORKDIR /opt/obs/frontend
|
|
|
|
ADD frontend/package.json frontend/package-lock.json /opt/obs/frontend/
|
|
|
|
RUN echo update-notifier=false >> ~/.npmrc
|
|
|
|
RUN npm ci
|
|
|
|
|
2021-11-27 21:44:19 +00:00
|
|
|
ADD frontend/tsconfig.json frontend/webpack.config.js /opt/obs/frontend/
|
2021-11-14 22:42:02 +00:00
|
|
|
ADD frontend/src /opt/obs/frontend/src/
|
|
|
|
ADD frontend/public /opt/obs/frontend/public/
|
|
|
|
|
|
|
|
RUN npm run build
|
|
|
|
|
|
|
|
#############################################
|
|
|
|
# Build the API and add the built frontend to it
|
|
|
|
#############################################
|
|
|
|
|
|
|
|
FROM python:3.9.7-bullseye
|
|
|
|
|
2022-01-02 12:12:58 +00:00
|
|
|
RUN apt-get update &&\
|
|
|
|
apt-get install -y \
|
|
|
|
libboost-dev \
|
|
|
|
libboost-system-dev \
|
|
|
|
libboost-filesystem-dev \
|
|
|
|
libexpat1-dev \
|
|
|
|
zlib1g-dev \
|
|
|
|
libbz2-dev \
|
|
|
|
libpq-dev \
|
|
|
|
libproj-dev \
|
|
|
|
lua5.3 \
|
|
|
|
liblua5.3-dev &&\
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2021-11-14 22:42:02 +00:00
|
|
|
WORKDIR /opt/obs/api
|
|
|
|
|
|
|
|
ADD api/requirements.txt /opt/obs/api/
|
|
|
|
RUN pip install -r requirements.txt
|
|
|
|
|
2021-11-21 16:05:46 +00:00
|
|
|
ADD tile-generator /opt/obs/tile-generator
|
|
|
|
|
2021-11-14 22:42:02 +00:00
|
|
|
ADD api/scripts /opt/obs/scripts
|
|
|
|
RUN pip install -e /opt/obs/scripts
|
|
|
|
|
|
|
|
ADD api/setup.py /opt/obs/api/
|
|
|
|
ADD api/obs /opt/obs/api/obs/
|
2021-11-21 16:05:46 +00:00
|
|
|
ADD api/tools /opt/obs/api/tools/
|
2021-11-14 22:42:02 +00:00
|
|
|
RUN pip install -e /opt/obs/api/
|
|
|
|
|
2022-01-02 12:39:07 +00:00
|
|
|
ADD roads_import.lua /opt/obs/api/tools
|
|
|
|
ADD osm2pgsql.sh /opt/obs/api/tools
|
2022-01-02 12:12:58 +00:00
|
|
|
|
2021-11-14 22:42:02 +00:00
|
|
|
COPY --from=frontend-builder /opt/obs/frontend/build /opt/obs/frontend/build
|
2022-01-02 12:12:58 +00:00
|
|
|
COPY --from=osm2pgsql-builder /usr/local/bin/osm2pgsql /usr/local/bin/osm2pgsql
|
2021-11-14 22:42:02 +00:00
|
|
|
|
2022-01-02 20:14:52 +00:00
|
|
|
EXPOSE 3000
|
2021-11-14 22:42:02 +00:00
|
|
|
|
|
|
|
CMD ["openbikesensor-api"]
|