Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧 Fix Docker deployment #1070

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ on:
push:
tags:
- '*.*.*'
pull_request:
paths: ['docker/**']

env:
NEEDS_VERSION: 2.0.0
DEPLOY_IMAGE: ${{ github.event_name != 'pull_request' }}

jobs:
build:
strategy:
fail-fast: ${{ github.event_name != 'pull_request' }}
matrix:
base-image: ["sphinxdoc/sphinx:latest", "sphinxdoc/sphinx-latexpdf:latest"]
image: ["sphinxneeds", "sphinxneeds-latexpdf"]
Expand Down Expand Up @@ -46,30 +51,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 }}
7 changes: 3 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading