Skip to content

Commit df41aac

Browse files
authored
Add base image for GLPI development environment
1 parent 920c8ad commit df41aac

File tree

4 files changed

+207
-0
lines changed

4 files changed

+207
-0
lines changed
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: "GLPI development environment image"
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
paths:
8+
- ".github/workflows/glpi-development-env.yml"
9+
- "glpi-development-env/**"
10+
pull_request:
11+
paths:
12+
- ".github/workflows/glpi-development-env.yml"
13+
- "glpi-development-env/**"
14+
schedule:
15+
- cron: '0 0 * * 1'
16+
# Enable manual run
17+
workflow_dispatch:
18+
19+
jobs:
20+
build:
21+
runs-on: "ubuntu-latest"
22+
steps:
23+
- name: "Set variables"
24+
run: |
25+
OUTPUTS="type=image"
26+
if [[ "${{ github.ref }}" = 'refs/heads/main' && "${{ github.repository }}" = 'glpi-project/docker-images' ]]; then
27+
OUTPUTS="$OUTPUTS,push=true"
28+
fi
29+
echo "OUTPUTS=$OUTPUTS" >> $GITHUB_ENV
30+
- name: "Checkout"
31+
uses: "actions/checkout@v4"
32+
- name: "Set up Docker Buildx"
33+
uses: "docker/setup-buildx-action@v3"
34+
- name: "Login to DockerHub"
35+
uses: "docker/login-action@v3"
36+
with:
37+
username: "${{ secrets.DOCKER_HUB_USERNAME }}"
38+
password: "${{ secrets.DOCKER_HUB_TOKEN }}"
39+
- name: "Login to Github container registry"
40+
uses: "docker/login-action@v3"
41+
with:
42+
registry: "ghcr.io"
43+
username: "${{ secrets.GHCR_USERNAME }}"
44+
password: "${{ secrets.GHCR_ACCESS_TOKEN }}"
45+
- name: "Build and push"
46+
uses: "docker/build-push-action@v5"
47+
with:
48+
build-args: |
49+
BASE_IMAGE=php:apache-bullseye
50+
cache-from: "type=gha"
51+
cache-to: "type=gha,mode=max"
52+
context: "glpi-development-env"
53+
outputs: "${{ env.OUTPUTS }}"
54+
pull: true
55+
tags: "ghcr.io/glpi-project/glpi-development-env:latest"

glpi-development-env/Dockerfile

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
ARG BASE_IMAGE=php:apache-bullseye
2+
3+
4+
#####
5+
# Fetch composer latest build
6+
#####
7+
FROM composer:latest AS composer
8+
9+
#####
10+
# Build main image
11+
#####
12+
FROM $BASE_IMAGE
13+
14+
LABEL \
15+
org.opencontainers.image.title="GLPI development environment" \
16+
org.opencontainers.image.description="This container can be used to serve GLPI in a development environment." \
17+
org.opencontainers.image.url="https://github.com/glpi-project/docker-images" \
18+
org.opencontainers.image.source="[email protected]:glpi-project/docker-images"
19+
20+
RUN apt update \
21+
\
22+
# Install bz2 extension (for marketplace).
23+
&& apt install --assume-yes --no-install-recommends --quiet libbz2-dev \
24+
&& docker-php-ext-install bz2 \
25+
\
26+
# Install exif extension.
27+
&& docker-php-ext-install exif \
28+
\
29+
# Install GD PHP extension.
30+
&& apt install --assume-yes --no-install-recommends --quiet libfreetype6-dev libjpeg-dev libpng-dev libwebp-dev \
31+
&& docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
32+
&& docker-php-ext-install gd \
33+
\
34+
# Install intl PHP extension.
35+
&& apt install --assume-yes --no-install-recommends --quiet libicu-dev \
36+
&& docker-php-ext-install intl \
37+
\
38+
# Install ldap PHP extension.
39+
&& apt install --assume-yes --no-install-recommends --quiet libldap2-dev \
40+
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
41+
&& docker-php-ext-install ldap \
42+
\
43+
# Install memcached PHP extension.
44+
&& apt install --assume-yes --no-install-recommends --quiet libmemcached-dev \
45+
&& pecl install memcached \
46+
&& docker-php-ext-enable memcached \
47+
\
48+
# Install mysqli PHP extension.
49+
&& docker-php-ext-install mysqli \
50+
\
51+
# Install opcache PHP extension.
52+
&& docker-php-ext-install opcache \
53+
\
54+
# Install pcntl PHP extension (required for composer-require-checker).
55+
&& docker-php-ext-install pcntl \
56+
\
57+
# Install redis PHP extension.
58+
&& pecl install redis \
59+
&& docker-php-ext-enable redis \
60+
\
61+
# Install Zip PHP extension.
62+
&& apt install --assume-yes --no-install-recommends --quiet libzip-dev \
63+
&& docker-php-ext-install zip \
64+
\
65+
# Install xdebug PHP extension.
66+
&& pecl install xdebug \
67+
&& docker-php-ext-enable xdebug \
68+
\
69+
# Install XMLRPC PHP extension.
70+
# Install from Github (extension should be available on PECL but is not)
71+
&& apt install --assume-yes --no-install-recommends --quiet libxml2-dev \
72+
&& mkdir -p /tmp/xmlrpc \
73+
&& (curl -LsfS https://github.com/php/pecl-networking-xmlrpc/archive/0f782ffe52cebd0a65356427b7ab72d48b72d20c/xmlrpc-0f782ff.tar.gz | tar xvz -C "/tmp/xmlrpc" --strip 1) \
74+
&& docker-php-ext-configure /tmp/xmlrpc --with-xmlrpc \
75+
&& docker-php-ext-install /tmp/xmlrpc \
76+
&& rm -rf /tmp/xmlrpc \
77+
\
78+
# Enable apache mods.
79+
&& a2enmod rewrite \
80+
\
81+
# Install nodejs and npm.
82+
&& apt install --assume-yes --no-install-recommends --quiet gnupg \
83+
&& mkdir -p /etc/apt/keyrings \
84+
&& curl --fail --silent --show-error --location https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor --output /etc/apt/keyrings/nodesource.gpg \
85+
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
86+
&& apt update \
87+
&& apt install --assume-yes --no-install-recommends --quiet nodejs \
88+
\
89+
# Install git and zip used by composer when fetching dependencies.
90+
&& apt install --assume-yes --no-install-recommends --quiet git unzip \
91+
\
92+
# Install gettext used for translation files.
93+
&& apt install --assume-yes --no-install-recommends --quiet gettext \
94+
\
95+
# Install Cypress dependencies
96+
&& apt install --assume-yes --no-install-recommends --quiet libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb \
97+
\
98+
# Install dependencies for plugin release tool
99+
&& apt install --assume-yes --no-install-recommends --quiet gpg python3 python3-git python3-gitdb python3-github python3-lxml python3-termcolor \
100+
&& ln -s /usr/bin/python3 /usr/bin/python \
101+
\
102+
# Install transifex client
103+
&& (cd /usr/local/bin/ && curl --silent --location https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash) \
104+
\
105+
# Install misc util packages commonly used by developers
106+
&& apt install --assume-yes --no-install-recommends --quiet htop nano sudo vim zsh \
107+
\
108+
# Clean sources list
109+
&& rm -rf /var/lib/apt/lists/*
110+
111+
# Copy composer binary
112+
COPY --from=composer /usr/bin/composer /usr/bin/composer
113+
114+
# Copy default PHP development configuration
115+
RUN cp "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
116+
117+
# Copy files to container.
118+
COPY ./files/etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-default.conf
119+
COPY ./files/etc/php/conf.d/glpi.ini $PHP_INI_DIR/conf.d/glpi.ini
120+
121+
# Define GLPI environment variables
122+
ENV \
123+
GLPI_ENVIRONMENT_TYPE=development
124+
125+
USER www-data
126+
WORKDIR /var/www/glpi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<VirtualHost *:80>
2+
DocumentRoot /var/www/glpi/public
3+
4+
ErrorLog ${APACHE_LOG_DIR}/error.log
5+
CustomLog ${APACHE_LOG_DIR}/access.log combined
6+
7+
<Directory /var/www/glpi/public>
8+
Require all granted
9+
10+
RewriteEngine On
11+
12+
# Prevent bearer authorization token filtering
13+
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
14+
15+
# Redirect all requests to GLPI router, unless file exists.
16+
RewriteCond %{REQUEST_FILENAME} !-f
17+
RewriteRule ^(.*)$ index.php [QSA,L]
18+
</Directory>
19+
</VirtualHost>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
; Session cookies security
3+
session.cookie_httponly = on
4+
5+
[xdebug]
6+
xdebug.mode=develop
7+
xdebug.start_with_request=trigger

0 commit comments

Comments
 (0)