Change mechanics of Docker image build and usage

- Introduce a GH Action to build Docker image for docs generation every time the Dockerfile is changed
- Trigger docs generation when a new Docker image was built
- Minor fix in Dockerfile to avoid outdated apt database

Signed-off-by: Peter Goetz <pego@amazon.com>
This commit is contained in:
Peter Goetz 2022-10-17 14:02:29 +02:00 коммит произвёл Peter Götz
Родитель 9b7e6a74c4
Коммит 3c5cf3a67b
3 изменённых файлов: 34 добавлений и 4 удалений

26
.github/workflows/build-docker-image-docs.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,26 @@
name: Build Docker image (docs)
on:
push:
branches: [main]
paths: ['docs/Dockerfile']
pull_request:
branches: [main]
paths: ['docs/Dockerfile']
jobs:
build-and-push-docker-image:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v2
name: Checkout repository
- uses: pmorelli92/github-container-registry-build-push@2.0.0
name: Build and Publish latest service image
with:
github-push-secret: ${{secrets.GITHUB_TOKEN}}
docker-image-name: dowhy-docs-generation
docker-image-tag: latest # optional
dockerfile-path: ./docs/Dockerfile # optional

8
.github/workflows/docs.yml поставляемый
Просмотреть файл

@ -3,12 +3,16 @@ on:
push:
branches:
- main
workflow_run:
workflows: [ "Build Docker image used for docs generation" ]
types:
- completed
jobs:
docs:
runs-on: ubuntu-latest
container:
image: darthtrevino/dowhy-docs
image: "ghcr.io/${{ github.repository_owner }}/dowhy-docs-generation:latest"
steps:
- uses: actions/checkout@main
with:

Просмотреть файл

@ -2,9 +2,9 @@
# This dockerfile was used to generate darthtrevino/dowhy-docs, used in the
# build-and-publish-docs.yml workflow
#
FROM pego/dowhy-examples-notebooks-deps
FROM ghcr.io/py-why/dowhy-example-notebooks-deps
RUN apt update
RUN DEBIAN_FRONTEND=noninteractive apt install --yes --quiet curl
RUN curl -sSL https://install.python-poetry.org | python3 - --version 1.2.1
ENV PATH=$PATH:/root/.local/share/pypoetry/venv/bin
ENV PATH=$PATH:/root/.local/share/pypoetry/venv/bin