Use dockerize to wait for services before running the containers

pull/101/head
admire 2020-05-09 23:10:11 +02:00
rodzic c325b1a78e
commit ffd8fb4080
4 zmienionych plików z 26 dodań i 9 usunięć

Wyświetl plik

@ -72,8 +72,6 @@ services:
- QGIS_STYLE=yes
# Use clip in the database - To use this you should have run make import_clip to add your clip to the DB
- CLIP=no
command: bash -c "while [ ! -f /home/settings/country.pbf ] ; do sleep 1; done && python3 -u /home/importer.py"
osmupdate:
build: docker-osmupdate
image: kartoza/docker-osm:osmupdate-latest
@ -107,10 +105,10 @@ services:
# seconds between 2 executions of the script
# if 0, then no update will be done, only the first initial import from the PBF
- TIME=120
command: bash -c "while [ ! -f /home/settings/country.pbf ] ; do sleep 1; done && python3 -u /home/download.py"
pgadmin4:
image: dpage/pgadmin4:4.16
image: dpage/pgadmin4:latest
hostname: pgadmin4
volumes:
- pgadmin_data:/var/lib/pgadmin
@ -146,4 +144,3 @@ services:
# seconds between 2 executions of the script
# if 0, then no update will be done, only the first initial import from the PBF
- TIME=120
command: bash -c "while [ ! -f /home/settings/importer.lock ] ; do sleep 1; done && python3 -u /home/enrich.py"

Wyświetl plik

@ -10,6 +10,12 @@ RUN apt update && apt install -y python3-pip \
gdal-bin \
--no-install-recommends
ENV \
DOCKERIZE_VERSION=v0.6.1
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
RUN ln -s /usr/lib/libgeos_c.so /usr/lib/libgeos.so
WORKDIR $GOPATH
@ -23,4 +29,5 @@ RUN pip3 install -r /home/requirements.txt
ADD importer.py /home/
WORKDIR /home
CMD ["python3", "-u", "/home/importer.py"]
CMD [ "dockerize", "-wait","file:///home/settings/country.pbf","python3" , "-u", "/home/importer.py" ]

Wyświetl plik

@ -3,9 +3,17 @@ MAINTAINER Irwan Fathurrahman <meomancer@gmail.com>
ADD requirements.txt /home/requirements.txt
RUN pip3 install -r /home/requirements.txt
ENV \
DOCKERIZE_VERSION=v0.6.1
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
ADD enrich.py /home/
WORKDIR /home
CMD ["python3", "-u", "/home/enrich.py"]
CMD [ "dockerize", "-wait","file:///home/settings/importer.lock", "python3" , "-u", "/home/enrich.py" ]

Wyświetl plik

@ -24,8 +24,13 @@ ADD osmupdate.c /home/osmupdate.c
ADD osmconvert.c /home/osmconvert.c
RUN gcc -x c - -o osmupdate osmupdate.c
RUN gcc -x c - -O3 -o osmconvert osmconvert.c -lz
ENV \
DOCKERIZE_VERSION=v0.6.1
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
# Add the python script which will call osmupdate
ADD download.py /home/download.py
CMD ["python3", "-u", "/home/download.py"]
CMD [ "dockerize", "-wait","file:///home/settings/country.pbf", "python3" , "-u", "/home/download.py" ]