Skip to content

Commit 2e6115b

Browse files
committed
Add PHP/Apache image with GLPI for plugins CI
1 parent c5ca083 commit 2e6115b

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: "GLPI Github Actions GLPI/Apache images"
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
paths:
8+
- ".github/workflows/githubactions-glpi-apache.yml"
9+
- "githubactions-glpi-apache/**"
10+
pull_request:
11+
paths:
12+
- ".github/workflows/githubactions-glpi-apache.yml"
13+
- "githubactions-glpi-apache/**"
14+
schedule:
15+
- cron: '0 22 * * *'
16+
# Enable manual run
17+
workflow_dispatch:
18+
19+
jobs:
20+
build:
21+
runs-on: "ubuntu-latest"
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
include:
26+
- {glpi-branch: "10.0/bugfixes", glpi-version: "10.0.x", php-version: "7.4"}
27+
- {glpi-branch: "10.0/bugfixes", glpi-version: "10.0.x", php-version: "8.0"}
28+
- {glpi-branch: "10.0/bugfixes", glpi-version: "10.0.x", php-version: "8.1"}
29+
- {glpi-branch: "10.0/bugfixes", glpi-version: "10.0.x", php-version: "8.2"}
30+
- {glpi-branch: "10.0/bugfixes", glpi-version: "10.0.x", php-version: "8.3"}
31+
- {glpi-branch: "main", glpi-version: "10.1.x", php-version: "8.1"}
32+
- {glpi-branch: "main", glpi-version: "10.1.x", php-version: "8.2"}
33+
- {glpi-branch: "main", glpi-version: "10.1.x", php-version: "8.3"}
34+
steps:
35+
- name: "Set variables"
36+
run: |
37+
OUTPUTS="type=image"
38+
if [[ "${{ github.ref }}" = 'refs/heads/main' && "${{ github.repository }}" = 'glpi-project/docker-images' ]]; then
39+
OUTPUTS="$OUTPUTS,push=true"
40+
fi
41+
echo "OUTPUTS=$OUTPUTS" >> $GITHUB_ENV
42+
- name: "Checkout"
43+
uses: "actions/checkout@v4"
44+
- name: "Set up Docker Buildx"
45+
uses: "docker/setup-buildx-action@v3"
46+
- name: "Login to DockerHub"
47+
uses: "docker/login-action@v3"
48+
with:
49+
username: "${{ secrets.DOCKER_HUB_USERNAME }}"
50+
password: "${{ secrets.DOCKER_HUB_TOKEN }}"
51+
- name: "Login to Github container registry"
52+
uses: "docker/login-action@v3"
53+
with:
54+
registry: "ghcr.io"
55+
username: "${{ secrets.GHCR_USERNAME }}"
56+
password: "${{ secrets.GHCR_ACCESS_TOKEN }}"
57+
- name: "Build and push"
58+
uses: "docker/build-push-action@v5"
59+
with:
60+
build-args: |
61+
BASE_IMAGE=ghcr.io/glpi-project/githubactions-php-apache:${{ matrix.php-version }}
62+
GLPI_BRANCH=${{ matrix.glpi-branch }}
63+
no-cache: true
64+
context: "githubactions-glpi-apache"
65+
outputs: "${{ env.OUTPUTS }}"
66+
pull: true
67+
tags: "ghcr.io/glpi-project/githubactions-glpi-apache:php-${{ matrix.php-version }}-glpi-${{ matrix.glpi-version }}"

githubactions-glpi-apache/Dockerfile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
ARG BASE_IMAGE
2+
3+
FROM $BASE_IMAGE
4+
5+
LABEL \
6+
org.opencontainers.image.title="GLPI Github Actions PHP/Apache container for GLPI plugins" \
7+
org.opencontainers.image.description="This container is used to run GLPI plugins test suites on Github Actions." \
8+
org.opencontainers.image.url="https://github.com/glpi-project/docker-images" \
9+
org.opencontainers.image.source="[email protected]:glpi-project/docker-images"
10+
11+
ARG GLPI_BRANCH
12+
13+
RUN \
14+
# Get target GLPI branch source code.
15+
git clone --depth=1 --branch=$GLPI_BRANCH https://github.com/glpi-project/glpi /tmp/glpi \
16+
&& git --git-dir="/tmp/glpi/.git" checkout-index --all --force --prefix="/var/www/glpi/" \
17+
\
18+
# Build GLPI.
19+
&& composer --working-dir=/var/www/glpi build \
20+
\
21+
# Clean useless files
22+
&& rm -rf /tmp/glpi \
23+
&& rm -rf /var/www/glpi/node_modules

0 commit comments

Comments
 (0)