Merge pull request #576 from cjmayo/docker

Release new Docker image hosted on GitHub Packages
This commit is contained in:
Chris Mayo 2021-11-29 19:34:03 +00:00 committed by GitHub
commit 822c607a33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 39 additions and 23 deletions

View file

@ -5,6 +5,7 @@ name: Create and publish a Docker image
on:
push:
branches: ['master']
tags: 'v*'
env:
REGISTRY: ghcr.io
@ -18,9 +19,6 @@ jobs:
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
@ -33,11 +31,14 @@ jobs:
uses: docker/metadata-action@548e2346a9987b56d8a4104fe776321ff8e23440
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: latest=true
tags: |
type=semver,pattern={{version}}
type=sha,prefix=
- name: Build and push Docker image
uses: docker/build-push-action@a66e35b9cbcf4ad0ea91ffcaf7bbad63ad9e0229
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View file

@ -1,14 +1,25 @@
FROM python:3-slim
# Use the maximum version for which dependency wheels are available
FROM python:3.9-slim
# needed to allow linkchecker create plugin directory and initial configuration file in "home" dir
# linkchecker creates ~/.linkchecker/ (700) containing linkcheckerrc et al
ENV HOME /tmp
RUN set -x \
&& pip install --no-cache-dir https://github.com/linkchecker/linkchecker/archive/master.zip
# /mnt enables linkchecker to access to access files on local machine if needed
# Enables access to local files when run with -v "$PWD":/mnt
VOLUME /mnt
WORKDIR /mnt
# Dependencies change on their own schedule so install them separately
RUN pip install --no-cache-dir \
beautifulsoup4 dnspython pyxdg requests cchardet polib
RUN set -x \
&& apt-get update -qq \
&& apt-get install -y -qq --no-install-recommends git \
&& pip install --no-cache-dir git+https://github.com/linkchecker/linkchecker.git \
&& apt-get -y -qq purge git \
&& apt-get autoremove -y -qq \
&& apt-get clean -y -qq all \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["linkchecker"]

View file

@ -79,3 +79,5 @@ recursive-include windows \
*.cer \
*.pfx \
*.pvk
prune .github/

View file

@ -47,14 +47,17 @@ For other options see ``linkchecker --help``.
Docker usage
-------------
*The Docker images are out-of-date, pip installation is the only currently recommended method.*
If you do not want to install any additional libraries/dependencies you can use the Docker image.
Example for external web site check::
docker run --rm -it -u $(id -u):$(id -g) linkchecker/linkchecker --verbose https://www.example.com
docker run --rm -it -u $(id -u):$(id -g) ghcr.io/linkchecker/linkchecker:latest --verbose https://www.example.com
Local HTML file check::
docker run --rm -it -u $(id -u):$(id -g) -v "$PWD":/mnt linkchecker/linkchecker --verbose index.html
docker run --rm -it -u $(id -u):$(id -g) -v "$PWD":/mnt ghcr.io/linkchecker/linkchecker:latest --verbose index.html
In addition to the rolling latest image, uniquely tagged images can also be found
on the `packages`_ page.
.. _packages: https://github.com/linkchecker/linkchecker/pkgs/container/linkchecker

View file

@ -59,7 +59,7 @@ Release process
1. check whether updated translations need committing
(`make locale; make -C doc locale; make -C doc man`)
2. bump AppVersion in `setup.py`, edit `changelog.txt`, and if applicable the
2. edit `changelog.txt`, and if applicable the
copyright date in `linkcheck/configuration/__init__.py`
3. confirm tests have passed
@ -74,6 +74,4 @@ Release process
8. check distribution files (`twine check dist/*`) and upload to PyPI (`twine upload dist/*`)
9. create release (vX.Y.Z) on GitHub (GitHub creates the .tar.gz and .zip archives)
10. increment AppVersion to vX.Y.Z+1.dev0
9. create release (vX.Y.Z) on GitHub (warn users about GitHub archives)

View file

@ -4,12 +4,11 @@ sys.path.insert(0, os.path.abspath('../..'))
# -- Project information -----------------------------------------------------
from datetime import date
import linkcheck.configuration
project = 'LinkChecker'
copyright = linkcheck.configuration.Copyright.split("Copyright (C) ")[1]
version = str(date.today())
version = linkcheck.configuration.Version
release = version
# -- General configuration ---------------------------------------------------

View file

@ -53,8 +53,6 @@ except ImportError:
else:
COMPILE_TRANSLATIONS = True
# the application version
AppVersion = "10.0.1"
# the application name
AppName = "LinkChecker"
Description = "check links in web documents or full websites"
@ -336,7 +334,10 @@ if os.name == "posix":
setup(
name=AppName,
version=AppVersion,
use_scm_version={
"local_scheme": "node-and-timestamp",
"version_scheme": "post-release",
},
description=Description,
keywords="link,url,site,checking,crawling,verification,validation",
author=myname,
@ -371,6 +372,7 @@ setup(
options={},
# Requirements, usable with setuptools or the new Python packaging module.
python_requires=">= 3.6",
setup_requires=["setuptools_scm"],
install_requires=[
"requests >= 2.4",
"dnspython >= 2.0",