From af8fa705ddf31ac51d12a153079b7408cf7da47d Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Wed, 22 Aug 2018 13:14:00 +0200 Subject: [PATCH] Fix Dockerfile and docker instructions; --- doc/2.docker.md | 4 ++-- docker/Dockerfile | 23 ++++++++--------------- docker/fetch.sh | 7 +++++++ 3 files changed, 17 insertions(+), 17 deletions(-) create mode 100644 docker/fetch.sh diff --git a/doc/2.docker.md b/doc/2.docker.md index 53a0ceb..50f2c69 100644 --- a/doc/2.docker.md +++ b/doc/2.docker.md @@ -20,7 +20,7 @@ docker build -t phyks/flatisfy . mkdir flatisfy cd flatisfy FLATISFY_VOLUME=$(pwd) -docker run -it -e LOCAL_USER_ID=`id -u` -v $FLATISFY_VOLUME:/flatisfy phyks/flatisfy sh -c "cd /home/user/app && python -m flatisfy init-config > /flatisfy/config.json" +docker run --rm -it -e LOCAL_USER_ID=`id -u` -v $FLATISFY_VOLUME:/flatisfy phyks/flatisfy sh -c "cd /home/user/app && python -m flatisfy init-config > /flatisfy/config.json" ``` @@ -44,7 +44,7 @@ Your Flatisfy instance is now available at `localhost:8080`! To fetch new housing posts, you should manually call ``` -docker run -it -e LOCAL_USER_ID=`id -u` -v $FLATISFY_VOLUME:/flatisfy phyks/flatisfy /home/user/fetch.sh +docker run --rm -it -e LOCAL_USER_ID=`id -u` -v $FLATISFY_VOLUME:/flatisfy phyks/flatisfy /home/user/fetch.sh ``` This can be done easily in a crontask on your host system, to run it typically diff --git a/docker/Dockerfile b/docker/Dockerfile index 5dc517f..f85baf4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -26,25 +26,18 @@ RUN git clone --depth 1 https://git.weboob.org/weboob/devel /home/user/weboob \ RUN mkdir -p /flatisfy/data VOLUME /flatisfy -# Install Flatisfy. +COPY ./*.sh /home/user/ + +# Install Flatisfy, set up directories and permissions. RUN cd /home/user \ - && git clone https://git.phyks.me/Phyks/flatisfy/ ./app \ + && git clone https://framagit.org/phyks/Flatisfy/ ./app \ && cd ./app \ && pip install -r requirements.txt \ && npm install \ - && npm run build:prod - -RUN chown user:user -R /home/user -RUN mkdir -p /home/user/.local/share/flatisfy - -COPY ./run.sh /home/user/run.sh -RUN chmod +x /home/user/run.sh - -COPY ./entrypoint.sh /home/user/entrypoint.sh -RUN chmod +x /home/user/entrypoint.sh - -COPY ./update_weboob.sh /home/user/update_weboob.sh -RUN chmod +x /home/user/update_weboob.sh + && npm run build:prod \ + && mkdir -p /home/user/.local/share/flatisfy \ + && chown user:user -R /home/user \ + && chmod +x /home/user/*.sh # Run server. EXPOSE 8080 diff --git a/docker/fetch.sh b/docker/fetch.sh new file mode 100644 index 0000000..7ab7376 --- /dev/null +++ b/docker/fetch.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -e + +echo "Fetching new housing posts..." +cd /home/user/app +python -m flatisfy import -v --config /flatisfy/config.json +