pull/72/head
msramalho 2023-02-08 11:22:38 +00:00
rodzic 94406bda7a
commit 75459d2880
5 zmienionych plików z 55 dodań i 9 usunięć

Wyświetl plik

@ -0,0 +1,48 @@
name: Docker
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
release:
types: [published]
push:
branches: [ "dockerize" ]
tags: [ "v*.*.*" ]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: bellingcat/auto-archiver
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

Wyświetl plik

@ -11,12 +11,9 @@ name: Upload Python Package
on:
release:
types: [published]
push:
branches:
- dockerize
tags:
- 'v*.*.*'
branches: [ "dockerize" ]
tags: [ "v*.*.*" ]
permissions:
contents: read

Wyświetl plik

@ -21,7 +21,7 @@ RUN pip install --upgrade pip && \
# TODO: avoid copying unnecessary files, including .git
COPY Pipfile Pipfile.lock ./
RUN pipenv install --python=3.10 --system --deploy
ENV IS_DOCKER=1
# ENV IS_DOCKER=1
# doing this at the end helps during development, builds are quick
COPY ./src/ .

Wyświetl plik

@ -4,6 +4,7 @@ import mimetypes, uuid, os, pathlib
from jinja2 import Environment, FileSystemLoader
from urllib.parse import quote
from ..version import __version__
from ..core import Metadata, Media
from . import Formatter
@ -28,13 +29,13 @@ class HtmlFormatter(Formatter):
"detect_thumbnails": {"default": True, "help": "if true will group by thumbnails generated by thumbnail enricher by id 'thumbnail_00'"},
}
def format(self, item: Metadata) -> Media:
content = self.template.render(
url=item.get_url(),
title=item.get_title(),
media=item.media,
metadata=item.get_clean_metadata()
metadata=item.get_clean_metadata(),
version=__version__
)
html_path = os.path.join(item.get_tmp_dir(), f"formatted{str(uuid.uuid4())}.html")
with open(html_path, mode="w", encoding="utf-8") as outf:

Wyświetl plik

@ -162,7 +162,7 @@
{% endfor %}
</table>
<p style="text-align:center;">Made with <a href="https://github.com/bellingcat/auto-archiver">bellingcat/auto-archiver</a></p>
<p style="text-align:center;">Made with <a href="https://github.com/bellingcat/auto-archiver">bellingcat/auto-archiver</a> v{{ version }}</p>
</body>
<script defer>
// notification logic