Skip to content
Closed
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
72 changes: 72 additions & 0 deletions .github/workflows/githubactions-php-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: "Github actions PHP images (with Python tools)"

on:
push:
branches:
- "main"
paths:
- ".github/workflows/githubactions-php-python.yml"
- "githubactions-php-python/**"
pull_request:
paths:
- ".github/workflows/githubactions-php-python.yml"
- "githubactions-php-python/**"
schedule:
- cron: '0 0 * * 1'
# Enable manual run
workflow_dispatch:

env:
# These will check Repository Variables first (perfect for fork), then use the default
DOCKER_IMAGES_REPO: ${{ vars.DOCKER_IMAGES_REPO || 'glpi-project/docker-images' }}
GHCR_BASE_IMAGE: ${{ vars.GHCR_BASE_IMAGE || 'ghcr.io/glpi-project/githubactions-php' }}
GHCR_IMAGE: ${{ vars.GHCR_IMAGE || 'ghcr.io/glpi-project/githubactions-php-python' }}

jobs:
build:
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
- "8.5"
steps:
- name: "Set variables"
run: |
OUTPUTS="type=image"
if [[ "${{ github.ref }}" = 'refs/heads/main' && "${{ github.repository }}" = '${{ env.DOCKER_IMAGES_REPO }}' ]]; then
OUTPUTS="$OUTPUTS,push=true"
fi
echo "OUTPUTS=$OUTPUTS" >> $GITHUB_ENV
- name: "Checkout"
uses: "actions/checkout@v6"
- name: "Set up Docker Buildx"
uses: "docker/setup-buildx-action@v3"
- name: "Login to DockerHub"
uses: "docker/login-action@v3"
with:
username: "${{ secrets.DOCKER_HUB_USERNAME }}"
password: "${{ secrets.DOCKER_HUB_TOKEN }}"
- name: "Login to Github container registry"
uses: "docker/login-action@v3"
with:
registry: "ghcr.io"
username: "${{ secrets.GHCR_USERNAME }}"
password: "${{ secrets.GHCR_ACCESS_TOKEN }}"
- name: "Build and push"
uses: "docker/build-push-action@v6"
with:
build-args: |
BASE_IMAGE=${{ env.GHCR_BASE_IMAGE }}:${{ matrix.php-version }}
cache-from: "type=gha"
cache-to: "type=gha,mode=max"
context: "githubactions-php-python"
outputs: "${{ env.OUTPUTS }}"
pull: true
tags: "${{ env.GHCR_IMAGE }}:${{ matrix.php-version }}"
28 changes: 28 additions & 0 deletions githubactions-php-python/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
ARG BASE_IMAGE=ghcr.io/glpi-project/githubactions-php:8.2


#####
# Build main image
#####
FROM $BASE_IMAGE

LABEL \
org.opencontainers.image.title="GLPI Github Actions PHP container (with Python tools)" \
org.opencontainers.image.description="This container is used to run GLPI plugin release tools on Github Actions." \
org.opencontainers.image.url="https://github.com/glpi-project/docker-images" \
org.opencontainers.image.source="git@github.com:glpi-project/docker-images"

USER root

RUN \
# Update package list (base image cleans it at build time)
apt update --quiet \
\
# Install Python and dependencies used by https://github.com/glpi-project/tools (soon to be DEPRECATED)
&& apt install --assume-yes --no-install-recommends --quiet python3 python3-git python3-gitdb python3-github python3-lxml python3-termcolor \
&& ln -sf /usr/bin/python3 /usr/bin/python \
\
# Clean sources list.
&& rm -rf /var/lib/apt/lists/*

USER glpi
Loading