Skip to content

πŸ”§ Fix Docker deployment #44

πŸ”§ Fix Docker deployment

πŸ”§ Fix Docker deployment #44

Workflow file for this run

name: Docker-Image
on:
# Allow manual trigger
workflow_dispatch:
inputs:
# Ask if docker deployment needed when manually triggered
deploy:
description: 'Deploy Docker Image (y/n)?'
required: true
default: 'n'
push:
tags:
- '*.*.*'
pull_request:
paths: ['docker/**']
env:
NEEDS_VERSION: 2.0.0
DEPLOY_IMAGE: ${{ github.event_name != 'pull_request' }}
jobs:
build:
strategy:
matrix:
base-image: ["sphinxdoc/sphinx:latest", "sphinxdoc/sphinx-latexpdf:latest"]
image: ["sphinxneeds", "sphinxneeds-latexpdf"]
exclude:
- base-image: "sphinxdoc/sphinx:latest"
image: "sphinxneeds-latexpdf"
- base-image: "sphinxdoc/sphinx-latexpdf:latest"
image: "sphinxneeds"
name: "Image: ${{ matrix.image }} | Baseimage: ${{ matrix.base-image }}"
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- name: Checkout πŸ›ŽοΈ
uses: actions/checkout@v4
-
name: Set up Docker Build πŸ‹
uses: docker/setup-buildx-action@v3
-
name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}
flavor: |
latest=true
tags: |
type=pep440,pattern={{version}}
- name: Check if deployment manually disabled
if: github.event.inputs.deploy == 'n'
run: |
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 🐳
id: docker_build
uses: docker/build-push-action@v5
with:
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 }}