Add osm2pgsql to the portal container
- Build osm2pgsql in a separate woker - Fix EXPOSE port to 3000 - Add postgres to the backend network
This commit is contained in:
parent
b43f7a2ebb
commit
85911a2c97
57
Dockerfile
57
Dockerfile
|
@ -1,5 +1,44 @@
|
||||||
# This dockerfile is for the API + Frontend production image
|
# This dockerfile is for the API + Frontend production image
|
||||||
|
|
||||||
|
#############################################
|
||||||
|
# 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 .. &&\
|
||||||
|
make &&\
|
||||||
|
make install
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
# Build the frontend AS builder
|
# Build the frontend AS builder
|
||||||
#############################################
|
#############################################
|
||||||
|
@ -23,6 +62,20 @@ RUN npm run build
|
||||||
|
|
||||||
FROM python:3.9.7-bullseye
|
FROM python:3.9.7-bullseye
|
||||||
|
|
||||||
|
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/*
|
||||||
|
|
||||||
WORKDIR /opt/obs/api
|
WORKDIR /opt/obs/api
|
||||||
|
|
||||||
ADD api/requirements.txt /opt/obs/api/
|
ADD api/requirements.txt /opt/obs/api/
|
||||||
|
@ -38,9 +91,11 @@ ADD api/obs /opt/obs/api/obs/
|
||||||
ADD api/tools /opt/obs/api/tools/
|
ADD api/tools /opt/obs/api/tools/
|
||||||
RUN pip install -e /opt/obs/api/
|
RUN pip install -e /opt/obs/api/
|
||||||
|
|
||||||
|
ADD roads_import.lua /opt/obs/api/roads_import.lua
|
||||||
|
|
||||||
COPY --from=frontend-builder /opt/obs/frontend/build /opt/obs/frontend/build
|
COPY --from=frontend-builder /opt/obs/frontend/build /opt/obs/frontend/build
|
||||||
|
COPY --from=osm2pgsql-builder /usr/local/bin/osm2pgsql /usr/local/bin/osm2pgsql
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
CMD ["openbikesensor-api"]
|
CMD ["openbikesensor-api"]
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
version: '3'
|
version: '3.5'
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
gateway:
|
gateway:
|
||||||
|
@ -16,6 +16,8 @@ services:
|
||||||
POSTGRES_DB: obs
|
POSTGRES_DB: obs
|
||||||
volumes:
|
volumes:
|
||||||
- ./data/postgres/data:/var/lib/postgresql/data
|
- ./data/postgres/data:/var/lib/postgresql/data
|
||||||
|
networks:
|
||||||
|
- backend
|
||||||
|
|
||||||
portal:
|
portal:
|
||||||
image: openbikesensor-portal
|
image: openbikesensor-portal
|
||||||
|
|
Loading…
Reference in a new issue