Skip to content

Commit 6ffb097

Browse files
authored
🔧 Fix Docker deployment (#1070)
Fix the Docker build, which failed on the last deployment Also: - Add the new `plotting` extra, to install `matplotlib` - Makes the docker build workflow run (without deployment) in PRs that modify the Docker files, - fixes deprecation warning in workflow: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
1 parent f5fd092 commit 6ffb097

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

.github/workflows/docker.yaml

+15-13
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@ on:
1212
push:
1313
tags:
1414
- '*.*.*'
15+
pull_request:
16+
paths: ['docker/**']
17+
1518
env:
1619
NEEDS_VERSION: 2.0.0
20+
DEPLOY_IMAGE: ${{ github.event_name != 'pull_request' }}
1721

1822
jobs:
1923
build:
2024
strategy:
25+
fail-fast: ${{ github.event_name != 'pull_request' }}
2126
matrix:
2227
base-image: ["sphinxdoc/sphinx:latest", "sphinxdoc/sphinx-latexpdf:latest"]
2328
image: ["sphinxneeds", "sphinxneeds-latexpdf"]
@@ -46,30 +51,27 @@ jobs:
4651
latest=true
4752
tags: |
4853
type=pep440,pattern={{version}}
49-
-
50-
# Check if deployment is needed (if no manual trigger was done, defaults to 'y')
51-
name: Check if deployment is needed
52-
id: deploycheck
54+
55+
- name: Check if deployment manually disabled
56+
if: github.event.inputs.deploy == 'n'
5357
run: |
54-
DEPLOY_CHECK=${{ github.event.inputs.deploy }}
55-
echo "::set-output name=value::${DEPLOY_CHECK:-"y"}"
56-
-
57-
# Login to Docker Hub Docker Registry for deployment
58-
name: Login to Docker Hub Docker Registry 🐸
58+
echo "DEPLOY_IMAGE=false" >> "$GITHUB_ENV"
59+
60+
- name: Login to Docker Hub Docker Registry 🐸
5961
uses: docker/login-action@v3
6062
with:
6163
username: ${{ secrets.DOCKERHUB_USERNAME }}
6264
password: ${{ secrets.DOCKERHUB_TOKEN }}
63-
-
64-
name: Build and push html image to Doker Hub Docker Registry 🐳
65+
66+
- name: Build and push html image to Doker Hub Docker Registry 🐳
6567
id: docker_build
6668
uses: docker/build-push-action@v5
6769
with:
68-
push: ${{ github.event_name != 'pull_request' && steps.deploycheck.outputs.value == 'y' }}
70+
push: ${{ env.DEPLOY_IMAGE == 'true' }}
6971
file: docker/Dockerfile
7072
platforms: linux/amd64,linux/arm64
7173
build-args: |
7274
NEEDS_VERSION=${{ env.NEEDS_VERSION }}
7375
BASE_IMAGE=${{ matrix.base-image }}
7476
tags: ${{ steps.meta.outputs.tags }}
75-
labels: ${{ steps.meta.outputs.labels }}}
77+
labels: ${{ steps.meta.outputs.labels }}

docker/Dockerfile

+3-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ ARG DEBIAN_FRONTEND=noninteractive
1414

1515
# Install apt & make
1616
RUN \
17-
sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \
1817
apt-get update && \
1918
apt-get upgrade -y && \
2019
apt-get install -y --no-install-recommends sudo
@@ -48,11 +47,11 @@ RUN pip3 install --no-cache-dir \
4847
# Install Sphinx-Needs
4948
RUN \
5049
if [ -n "$NEEDS_VERSION" ] && [ "$NEEDS_VERSION" = "pre-release" ]; then \
51-
pip3 install --no-cache-dir git+https://github.com/useblocks/sphinx-needs; \
50+
pip3 install --no-cache-dir "sphinx-needs[plotting] @ git+https://github.com/useblocks/sphinx-needs"; \
5251
elif [ -n "$NEEDS_VERSION" ]; then \
53-
pip3 install --no-cache-dir git+https://github.com/useblocks/sphinx-needs@$NEEDS_VERSION; \
52+
pip3 install --no-cache-dir "sphinx-needs[plotting] @ git+https://github.com/useblocks/sphinx-needs@$NEEDS_VERSION"; \
5453
else \
55-
pip3 install --no-cache-dir sphinx-needs; \
54+
pip3 install --no-cache-dir sphinx-needs[plotting]; \
5655
fi
5756

5857
## Clean up

0 commit comments

Comments
 (0)