Skip to content

Commit

Permalink
Merge branch 'main' into feat/unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
pjrobertson committed Jan 13, 2025
2 parents b9aea99 + 9cdaea8 commit bdfedfc
Show file tree
Hide file tree
Showing 12 changed files with 3,338 additions and 2,350 deletions.
42 changes: 23 additions & 19 deletions .github/workflows/python-publish.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will upload a Python Package using Twine when a release is created
# This workflow uploads a Python Package to PyPI using Poetry when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
Expand All @@ -21,30 +21,34 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up Python 3.10
- name: Extract Python Version from pyproject.toml
id: python-version
run: |
version=$(grep 'python =' pyproject.toml | awk -F'"' '{print $2}' | tr -d '^~<=>')
echo "python-version=$version" >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: ${{ env.python-version }}

- name: Install Poetry
run: |
python -m pip install --upgrade pip
python -m pip install "poetry>=2.0.0,<3.0.0"
- name: Install dependencies
run: |
python -m pip install --upgrade --upgrade-strategy=eager pip setuptools wheel twine pipenv
python -m pip install -e . --upgrade
python -m pipenv install --dev --python 3.10
env:
PIPENV_DEFAULT_PYTHON_VERSION: "3.10"
poetry install --no-root
- name: Build wheels
- name: Build the package
run: |
python -m pipenv run python setup.py sdist bdist_wheel
poetry build
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
verbose: true
skip_existing: true
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: dist/
# Step 6: Publish to PyPI
- name: Publish to PyPI
run: |
poetry publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ auto_archiver.egg-info*
logs*
*.csv
archived/
dist*
66 changes: 47 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,58 @@
FROM webrecorder/browsertrix-crawler:1.0.4
FROM webrecorder/browsertrix-crawler:1.0.4 AS base

ENV RUNNING_IN_DOCKER=1
ENV RUNNING_IN_DOCKER=1 \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONFAULTHANDLER=1 \
PATH="/root/.local/bin:$PATH"

WORKDIR /app

RUN pip install --upgrade pip && \
pip install pipenv && \
add-apt-repository ppa:mozillateam/ppa && \
# Installing system dependencies
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*
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* && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*


# Poetry and runtime
FROM base AS runtime

COPY Pipfile* ./
# install from pipenv, with browsertrix-only requirements
RUN pipenv install
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1

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

ENTRYPOINT ["pipenv", "run", "python3", "-m", "auto_archiver"]
RUN pip install --upgrade pip && \
pip install "poetry>=2.0.0,<3.0.0"

WORKDIR /app


COPY pyproject.toml poetry.lock README.md ./
# Copy dependency files and install dependencies (excluding the package itself)
RUN poetry install --only main --no-root --no-cache


# Copy code: This is needed for poetry to install the package itself,
# but the environment should be cached from the previous step if toml and lock files haven't changed
COPY ./src/ .
RUN poetry install --only main --no-cache


# Update PATH to include virtual environment binaries
# Allowing entry point to run the application directly with Python
ENV VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH"

ENTRYPOINT ["python3", "-m", "auto_archiver"]

# 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

51 changes: 0 additions & 51 deletions Pipfile

This file was deleted.

Loading

0 comments on commit bdfedfc

Please sign in to comment.