From 09f47383a3478ff43ff01aa659316782154167b6 Mon Sep 17 00:00:00 2001 From: msramalho <19508417+msramalho@users.noreply.github.com> Date: Tue, 8 Nov 2022 13:59:35 +0000 Subject: [PATCH] dockerfile improvements --- Dockerfile | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index b2de36a..a9b4d7a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,34 @@ +# stage 1 - all dependencies From python:3.10 WORKDIR /app -COPY . . - - # TODO: use custom ffmpeg builds instead of apt-get install RUN pip install --upgrade pip && \ pip install pipenv && \ apt-get update && \ - apt-get install -y gcc ffmpeg fonts-noto firefox-esr - -RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux64.tar.gz && \ + apt-get install -y gcc ffmpeg fonts-noto firefox-esr && \ + wget https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux64.tar.gz && \ tar -xvzf geckodriver* -C /usr/local/bin && \ chmod +x /usr/local/bin/geckodriver && \ - rm geckodriver-v* && \ - pipenv install --python=3.10 + rm geckodriver-v* + + +# install docker for WACZ +RUN curl -fsSL https://get.docker.com | sh + +# RUN git clone https://github.com/bellingcat/auto-archiver +# TODO: avoid copying unnecessary files, including .git +# COPY ./src/ . +COPY Pipfile Pipfile.lock ./ +RUN pipenv install --python=3.10 --system --deploy +# TODO: to avoid copying pipfile lock it should be on the .dockerignore +ENV IS_DOCKER=1 +COPY . . # CMD ["pipenv", "run", "python", "auto_archive.py"] -ENTRYPOINT ["pipenv", "run", "python", "auto_archive.py"] +ENTRYPOINT ["python", "auto_archive.py"] +# ENTRYPOINT ["docker-entrypoint.sh"] # should be executed with 2 volumes -# docker run -v /var/run/docker.sock:/var/run/docker.sock -v $PWD/secrets:/app/ aa --help \ No newline at end of file +# docker run -v /var/run/docker.sock:/var/run/docker.sock -v $PWD/secrets:/app/secrets -v $PWD/local_archive:/app/local_archive aa --help \ No newline at end of file