From d1e823f2256105c491aa910d4bde8c151e5c0d1e Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Mon, 13 Nov 2023 18:10:25 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=94=A7=20Fix=20docker=20deployment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker.yaml | 27 ++++++++++++++------------- docker/Dockerfile | 7 +++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index cd375118b..72e9303f0 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -12,8 +12,12 @@ on: push: tags: - '*.*.*' + pull_request: + paths: ['docker/**'] + env: NEEDS_VERSION: 2.0.0 + DEPLOY_IMAGE: ${{ github.event_name != 'pull_request' }} jobs: build: @@ -46,30 +50,27 @@ jobs: latest=true tags: | type=pep440,pattern={{version}} - - - # Check if deployment is needed (if no manual trigger was done, defaults to 'y') - name: Check if deployment is needed - id: deploycheck + + - name: Check if deployment manually disabled + if: github.event.inputs.deploy == 'n' run: | - DEPLOY_CHECK=${{ github.event.inputs.deploy }} - echo "::set-output name=value::${DEPLOY_CHECK:-"y"}" - - - # Login to Docker Hub Docker Registry for deployment - name: Login to Docker Hub Docker Registry 🐸 + echo "DEPLOY_IMAGE=false" >> "$GITHUB_ENV" + + - name: Login to Docker Hub Docker Registry 🐸 uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push html image to Doker Hub Docker Registry 🐳 + + - name: Build and push html image to Doker Hub Docker Registry 🐳 id: docker_build uses: docker/build-push-action@v5 with: - push: ${{ github.event_name != 'pull_request' && steps.deploycheck.outputs.value == 'y' }} + push: ${{ env.DEPLOY_IMAGE == 'true' }} file: docker/Dockerfile platforms: linux/amd64,linux/arm64 build-args: | NEEDS_VERSION=${{ env.NEEDS_VERSION }} BASE_IMAGE=${{ matrix.base-image }} tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }}} + labels: ${{ steps.meta.outputs.labels }} diff --git a/docker/Dockerfile b/docker/Dockerfile index 36078bf25..1066680b3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,7 +14,6 @@ ARG DEBIAN_FRONTEND=noninteractive # Install apt & make RUN \ - sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \ apt-get update && \ apt-get upgrade -y && \ apt-get install -y --no-install-recommends sudo @@ -48,11 +47,11 @@ RUN pip3 install --no-cache-dir \ # Install Sphinx-Needs RUN \ if [ -n "$NEEDS_VERSION" ] && [ "$NEEDS_VERSION" = "pre-release" ]; then \ - pip3 install --no-cache-dir git+https://github.com/useblocks/sphinx-needs; \ + pip3 install --no-cache-dir "sphinx-needs[plotting] @ git+https://github.com/useblocks/sphinx-needs"; \ elif [ -n "$NEEDS_VERSION" ]; then \ - pip3 install --no-cache-dir git+https://github.com/useblocks/sphinx-needs@$NEEDS_VERSION; \ + pip3 install --no-cache-dir "sphinx-needs[plotting] @ git+https://github.com/useblocks/sphinx-needs@$NEEDS_VERSION"; \ else \ - pip3 install --no-cache-dir sphinx-needs; \ + pip3 install --no-cache-dir sphinx-needs[plotting]; \ fi ## Clean up From 8f4424d332b40e194f47b86780ebf9d4d702de70 Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Mon, 13 Nov 2023 19:05:49 +0000 Subject: [PATCH 2/2] Update docker.yaml --- .github/workflows/docker.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 72e9303f0..42faf2298 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -22,6 +22,7 @@ env: jobs: build: strategy: + fail-fast: ${{ github.event_name != 'pull_request' }} matrix: base-image: ["sphinxdoc/sphinx:latest", "sphinxdoc/sphinx-latexpdf:latest"] image: ["sphinxneeds", "sphinxneeds-latexpdf"]