Skip to content

Commit

Permalink
Automatically resolve/update Chromium version
Browse files Browse the repository at this point in the history
  • Loading branch information
milesmcc committed Oct 27, 2023
1 parent 6b79f13 commit db17801
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ RUN su ${USERNAME} -c "mix local.hex --force \
# Add Atlos-specific dependencies
RUN apt-get update \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends ffmpeg imagemagick curl python3 python3-dev python3-pip chromium=118.0.5993.70-1~deb11u1
&& apt-get -y install --no-install-recommends ffmpeg imagemagick curl python3 python3-dev python3-pip chromium
RUN pip3 install poetry
2 changes: 1 addition & 1 deletion platform/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ COPY utils utils
ENV UTILS_DIR="/app/utils"

# Install packages needed for runtime environment
RUN apt-get update -y && apt-get install -y ffmpeg imagemagick curl python3 python3-pip chromium=118.0.5993.70-1~deb11u1 tmpreaper ca-certificates postgresql-client netcat jq \
RUN apt-get update -y && apt-get install -y ffmpeg imagemagick curl python3 python3-pip chromium tmpreaper ca-certificates postgresql-client netcat jq \
&& apt-get clean && rm -f /var/lib/apt/lists/*_* && python3 -m pip install poetry

USER atlos
Expand Down
13 changes: 9 additions & 4 deletions platform/utils/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.core.os_manager import ChromeType
from selenium.webdriver.common.print_page_options import PrintOptions
from webdriver_manager.core.utils import read_version_from_cmd
from webdriver_manager.core.os_manager import PATTERN

# Make sure we install the right version of the Chrome driver
chromedriver_version = read_version_from_cmd("chromium --version", PATTERN["chromium"])

# From https://github.com/bellingcat/auto-archiver/blob/dockerize/src/auto_archiver/utils/url.py#L3
is_telegram_private = re.compile(r"https:\/\/t\.me(\/c)\/(.+)\/(\d+)")
Expand Down Expand Up @@ -102,7 +107,9 @@ def archive_page_using_selenium(url: str) -> dict:
driver = webdriver.Chrome(
service=ChromiumService(
# If you update this version, be sure to also update the version in all Dockerfiles
ChromeDriverManager(chrome_type=ChromeType.CHROMIUM, driver_version="118.0.5993.70").install()
ChromeDriverManager(
chrome_type=ChromeType.CHROMIUM, driver_version=chromedriver_version
).install()
),
options=options,
)
Expand Down Expand Up @@ -362,9 +369,7 @@ def run(url, file, out, auto_archiver_config):
direct_archive,
os.path.join(out, path),
)
artifacts.append(
analyze_artifact(direct_archive, kind="direct_file")
)
artifacts.append(analyze_artifact(direct_archive, kind="direct_file"))

# Write the metadata
with open(os.path.join(out, "metadata.json"), "w") as outfile:
Expand Down

0 comments on commit db17801

Please sign in to comment.