Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize the Docker file - fixes #1 #153

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 28 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,44 @@
FROM webrecorder/browsertrix-crawler:1.0.4
FROM webrecorder/browsertrix-crawler:1.0.4 AS base

ENV RUNNING_IN_DOCKER=1

WORKDIR /app

RUN pip install --upgrade pip && \
pip install pipenv && \
add-apt-repository ppa:mozillateam/ppa && \
RUN add-apt-repository ppa:mozillateam/ppa && \
apt-get update && \
apt-get install -y gcc ffmpeg fonts-noto exiftool && \
apt-get install -y --no-install-recommends gcc ffmpeg fonts-noto exiftool && \
apt-get install -y --no-install-recommends firefox-esr && \
ln -s /usr/bin/firefox-esr /usr/bin/firefox && \
wget https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux64.tar.gz && \
tar -xvzf geckodriver* -C /usr/local/bin && \
chmod +x /usr/local/bin/geckodriver && \
rm geckodriver-v*
rm geckodriver-v* && \
rm -rf /var/lib/apt/lists/*

FROM base AS pipenv

ENV RUNNING_IN_DOCKER=1
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONFAULTHANDLER=1

WORKDIR /

RUN pip install pipenv
COPY Pipfile* ./
COPY Pipfile.lock .
# install from pipenv, with browsertrix-only requirements
RUN pipenv install
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy

# doing this at the end helps during development, builds are quick
COPY ./src/ .
FROM base AS runtime

WORKDIR /app

# Copy virtual env built in pipenv stage
COPY --from=pipenv /.venv /.venv
ENV PATH="/.venv/bin:$PATH"

ENTRYPOINT ["pipenv", "run", "python3", "-m", "auto_archiver"]
# doing this at the end helps during development, builds are quick
COPY ./src/ .

ENTRYPOINT ["python3", "-m", "auto_archiver"]
CMD ["--config", "secrets/orchestration.yaml"]
# should be executed with 2 volumes (3 if local_storage is used)
# docker run --rm -v $PWD/secrets:/app/secrets -v $PWD/local_archive:/app/local_archive aa pipenv run python3 -m auto_archiver --config secrets/orchestration.yaml