From b422abed6a745e7840ff6405ab40efbc357a181c Mon Sep 17 00:00:00 2001 From: xxyzz Date: Mon, 13 Nov 2023 15:19:31 +0800 Subject: [PATCH 1/2] Add Containerfile --- Containerfile | 7 +++++++ README.md | 19 ++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 Containerfile diff --git a/Containerfile b/Containerfile new file mode 100644 index 00000000..c31caedb --- /dev/null +++ b/Containerfile @@ -0,0 +1,7 @@ +FROM docker.io/python +RUN apt update && apt install -y lbzip2 +COPY pyproject.toml README.md LICENSE . +COPY src src +RUN python -m pip install -U pip +RUN python -m pip install --use-pep517 . +ENTRYPOINT bash diff --git a/README.md b/README.md index 70d1babf..2ca2d92e 100644 --- a/README.md +++ b/README.md @@ -301,12 +301,19 @@ word `thrill` as an English verb (only one part-of-speech is shown here): ### Installing -Preparation: on Linux (example from Ubuntu 20.04), you may need to +#### Use container: + +``` +$ podman build -t wiktextract . +$ podman run -it --rm wiktextract wiktwords --help +``` + +#### Install from source: + +On Linux (example from Ubuntu 20.04), you may need to first install the `build-essential` and `python3-dev` packages with `apt update && apt install build-essential python3-dev python3-pip lbzip2`. -Install `wiktextract` from source: - ``` git clone https://github.com/tatuylonen/wiktextract.git cd wiktextract @@ -316,12 +323,6 @@ python -m pip install -U pip python -m pip install --use-pep517 . ``` -Alternatively, you can install the package from pypi.org: - -``` -python -m pip install wiktextract -``` - This software requires Python 3. ### Running tests From 39cf37b6c246a582713c6b8a2c276a1f768fbd73 Mon Sep 17 00:00:00 2001 From: xxyzz Date: Mon, 13 Nov 2023 18:07:53 +0800 Subject: [PATCH 2/2] Add push container image GitHub Actions --- .github/workflows/container.yml | 22 ++++++++++++++++++++++ Containerfile | 2 +- README.md | 3 +-- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/container.yml diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml new file mode 100644 index 00000000..3ca2540f --- /dev/null +++ b/.github/workflows/container.yml @@ -0,0 +1,22 @@ +name: Publish container + +on: + workflow_run: + workflows: [test] + types: + - completed + branches: + - master + +jobs: + publish_container: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + - run: podman login -u ${{ github.repository_owner }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io + - run: podman build -t ghcr.io/${{ github.repository }} . + - run: podman push ghcr.io/${{ github.repository }} diff --git a/Containerfile b/Containerfile index c31caedb..ed3cb207 100644 --- a/Containerfile +++ b/Containerfile @@ -4,4 +4,4 @@ COPY pyproject.toml README.md LICENSE . COPY src src RUN python -m pip install -U pip RUN python -m pip install --use-pep517 . -ENTRYPOINT bash +ENTRYPOINT ["wiktwords"] diff --git a/README.md b/README.md index 2ca2d92e..b4aff931 100644 --- a/README.md +++ b/README.md @@ -304,8 +304,7 @@ word `thrill` as an English verb (only one part-of-speech is shown here): #### Use container: ``` -$ podman build -t wiktextract . -$ podman run -it --rm wiktextract wiktwords --help +$ podman run -it --rm ghcr.io/tatuylonen/wiktextract --help ``` #### Install from source: