kopia lustrzana https://github.com/bellingcat/auto-archiver
docker
rodzic
94406bda7a
commit
75459d2880
|
@ -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 }}
|
|
@ -11,12 +11,9 @@ name: Upload Python Package
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [published]
|
types: [published]
|
||||||
|
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [ "dockerize" ]
|
||||||
- dockerize
|
tags: [ "v*.*.*" ]
|
||||||
tags:
|
|
||||||
- 'v*.*.*'
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
|
@ -21,7 +21,7 @@ RUN pip install --upgrade pip && \
|
||||||
# TODO: avoid copying unnecessary files, including .git
|
# TODO: avoid copying unnecessary files, including .git
|
||||||
COPY Pipfile Pipfile.lock ./
|
COPY Pipfile Pipfile.lock ./
|
||||||
RUN pipenv install --python=3.10 --system --deploy
|
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
|
# doing this at the end helps during development, builds are quick
|
||||||
COPY ./src/ .
|
COPY ./src/ .
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import mimetypes, uuid, os, pathlib
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
from ..version import __version__
|
||||||
from ..core import Metadata, Media
|
from ..core import Metadata, Media
|
||||||
from . import Formatter
|
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'"},
|
"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:
|
def format(self, item: Metadata) -> Media:
|
||||||
content = self.template.render(
|
content = self.template.render(
|
||||||
url=item.get_url(),
|
url=item.get_url(),
|
||||||
title=item.get_title(),
|
title=item.get_title(),
|
||||||
media=item.media,
|
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")
|
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:
|
with open(html_path, mode="w", encoding="utf-8") as outf:
|
||||||
|
|
|
@ -162,7 +162,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</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>
|
</body>
|
||||||
<script defer>
|
<script defer>
|
||||||
// notification logic
|
// notification logic
|
||||||
|
|
Ładowanie…
Reference in New Issue