Skip to content
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
142 changes: 28 additions & 114 deletions README.md

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
title: thecodingmachine/php
description: General purpose PHP images for Docker
baseurl: /docker-images-php
description_fr: Images PHP généralistes pour Docker
defaults:
- scope:
path: fr
values:
lang: fr
25 changes: 24 additions & 1 deletion docs/_data/nav.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,55 @@
# title_fr: the French title; bilingual: one page in both languages, French with #lang=fr, instead of a page under /fr/
- title: Start
title_fr: Démarrer
items:
- title: Overview
title_fr: Vue d'ensemble
url: /
- title: Variants
title_fr: Variantes
url: /variants.html
- title: Serve and size
- title: Images
title_fr: Images
url: /images.html
- title: Web server and tuning
title_fr: Serveur web et tuning
items:
- title: Serving with the fpm variant
title_fr: La variante fpm
url: /fpm.html
- title: Tuning simulator
title_fr: Simulateur de tuning
url: /tuning/
bilingual: true
- title: Behind a reverse proxy
title_fr: Derrière un reverse proxy
url: /reverse-proxy/
bilingual: true
- title: Configure
title_fr: Configurer
items:
- title: PHP extensions
title_fr: Extensions PHP
url: /extensions.html
- title: PHP configuration
title_fr: Configuration de PHP
url: /php-configuration.html
- title: Processes, cron, daemons
title_fr: Processus, cron, daemons
url: /processes.html
- title: Debugging, profiling, coverage
title_fr: Debugging, profiling, coverage
url: /debugging/
bilingual: true
- title: Advanced features
title_fr: Fonctions avancées
url: /advanced.html
- title: Project
title_fr: Projet
items:
- title: Security
title_fr: Sécurité
url: /security.html
- title: Contributing
title_fr: Contribuer
url: /contributing.html
126 changes: 112 additions & 14 deletions docs/_layouts/default.html
Original file line number Diff line number Diff line change
@@ -1,42 +1,140 @@
<!doctype html>
<html lang="en">
{%- assign lang = page.lang | default: 'en' -%}
{%- if lang == 'fr' -%}{%- assign en_url = page.url | remove_first: '/fr' -%}{%- assign fr_url = page.url -%}
{%- else -%}{%- assign en_url = page.url -%}{%- assign fr_url = page.url | prepend: '/fr' -%}{%- endif -%}
{%- assign title = page.title -%}{%- if lang == 'fr' and page.title_fr -%}{%- assign title = page.title_fr -%}{%- endif %}
<html lang="{{ lang }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% if page.title and page.url != "/" %}{{ page.title }} · {% endif %}{{ site.title }}</title>
<meta name="description" content="{{ page.description | default: site.description }}">
<title>{% if title and page.url != "/" and page.url != "/fr/" %}{{ title }} · {% endif %}{{ site.title }}</title>
<meta name="description" content="{% if lang == 'fr' %}{{ page.description_fr | default: page.description | default: site.description_fr }}{% else %}{{ page.description | default: site.description }}{% endif %}">
<link rel="stylesheet" href="{{ '/assets/css/site.css' | relative_url }}">
{%- if page.bilingual %}
<link rel="alternate" hreflang="en" href="{{ page.url | relative_url }}">
<link rel="alternate" hreflang="fr" href="{{ page.url | relative_url }}#lang=fr">
{%- else %}
<link rel="alternate" hreflang="en" href="{{ en_url | relative_url }}">
<link rel="alternate" hreflang="fr" href="{{ fr_url | relative_url }}">
{%- endif %}
</head>
<body{% if page.wide %} class="wide"{% endif %}>
<body class="{% if page.wide %}wide{% endif %}" data-lang="{{ lang }}">
<header class="site">
<a class="brand" href="{{ '/' | relative_url }}">thecodingmachine/php</a>
<span class="release">v5 documentation</span>
<a class="repo" href="https://github.com/thecodingmachine/docker-images-php">GitHub</a>
<div class="site-bar">
{%- if page.bilingual %}
<a class="brand" href="{{ '/' | relative_url }}" data-l="en"><img src="{{ '/assets/img/tcm-logo.svg' | relative_url }}" alt="TheCodingMachine"><span class="sep"></span><span class="name">PHP images</span></a>
<a class="brand" href="{{ '/fr/' | relative_url }}" data-l="fr"><img src="{{ '/assets/img/tcm-logo.svg' | relative_url }}" alt="TheCodingMachine"><span class="sep"></span><span class="name">Images PHP</span></a>
<span class="release"><span data-l="en">v5 docs</span><span data-l="fr">doc v5</span></span>
{%- else %}
<a class="brand" href="{{ '/' | relative_url }}{% if lang == 'fr' %}fr/{% endif %}"><img src="{{ '/assets/img/tcm-logo.svg' | relative_url }}" alt="TheCodingMachine"><span class="sep"></span><span class="name">{% if lang == 'fr' %}Images PHP{% else %}PHP images{% endif %}</span></a>
<span class="release">{% if lang == 'fr' %}doc v5{% else %}v5 docs{% endif %}</span>
{%- endif %}
<nav class="langs" aria-label="Language">
{%- if page.bilingual %}
<a href="#" data-set-lang="en" hreflang="en">EN</a><a href="#lang=fr" data-set-lang="fr" hreflang="fr">FR</a>
{%- else %}
<a href="{{ en_url | relative_url }}" hreflang="en"{% if lang == 'en' %} aria-current="true"{% endif %}>EN</a><a href="{{ fr_url | relative_url }}" hreflang="fr"{% if lang == 'fr' %} aria-current="true"{% endif %}>FR</a>
{%- endif %}
</nav>
<a class="repo" href="https://github.com/thecodingmachine/docker-images-php" aria-label="GitHub"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg><span class="name">GitHub</span></a>
</div>
</header>
<div class="layout">
<nav class="side" aria-label="Documentation">
<details open>
<summary>Menu</summary>
{% for section in site.data.nav %}
<h4>{{ section.title }}</h4>
{%- for section in site.data.nav %}
{%- if page.bilingual %}
<h4><span data-l="en">{{ section.title }}</span><span data-l="fr">{{ section.title_fr }}</span></h4>
{%- else %}
<h4>{% if lang == 'fr' %}{{ section.title_fr }}{% else %}{{ section.title }}{% endif %}</h4>
{%- endif %}
<ul>
{% for item in section.items %}
{%- for item in section.items %}
{%- if item.bilingual %}{%- assign item_fr = item.url | append: '#lang=fr' -%}{%- else -%}{%- assign item_fr = item.url | prepend: '/fr' -%}{%- endif %}
{%- if page.bilingual %}
<li data-l="en"><a href="{{ item.url | relative_url }}"{% if page.url == item.url %} aria-current="page"{% endif %}>{{ item.title }}</a></li>
<li data-l="fr"><a href="{{ item_fr | relative_url }}"{% if page.url == item.url %} aria-current="page"{% endif %}>{{ item.title_fr }}</a></li>
{%- elsif lang == 'fr' %}
<li><a href="{{ item_fr | relative_url }}"{% if page.url == item_fr %} aria-current="page"{% endif %}>{{ item.title_fr }}</a></li>
{%- else %}
<li><a href="{{ item.url | relative_url }}"{% if page.url == item.url %} aria-current="page"{% endif %}>{{ item.title }}</a></li>
{% endfor %}
{%- endif %}
{%- endfor %}
</ul>
{% endfor %}
{%- endfor %}
</details>
</nav>
<main class="content">
{%- if page.wide %}
{{ content }}
{%- else %}
<article class="prose">
{{ content }}
</article>
{%- endif %}
</main>
</div>
<footer class="site">
<a href="https://github.com/thecodingmachine/docker-images-php">thecodingmachine/docker-images-php</a> ·
<div class="site-bar">
<a href="https://github.com/thecodingmachine/docker-images-php">thecodingmachine/docker-images-php</a>
<a href="https://github.com/thecodingmachine/docker-images-php/issues">Issues</a>
<a href="https://github.com/thecodingmachine/docker-images-php/blob/v5/LICENSE">MIT</a>
<a class="by" href="https://thecodingmachine.com/"><span>{% if page.bilingual %}<span data-l="en">Maintained by</span><span data-l="fr">Maintenu par</span>{% elsif lang == 'fr' %}Maintenu par{% else %}Maintained by{% endif %}</span><img src="{{ '/assets/img/tcm-logo.svg' | relative_url }}" alt="TheCodingMachine"></a>
</div>
</footer>
<script>
if (matchMedia('(max-width: 860px)').matches) document.querySelector('nav.side details').removeAttribute('open');
if (matchMedia('(max-width: 900px)').matches) document.querySelector('nav.side details').removeAttribute('open');
// Copy buttons: on the code blocks, and on the image tags of the tables
(() => {
const label = (en, fr) => document.documentElement.lang === 'fr' ? fr : en;
const copy = (el, text) => navigator.clipboard.writeText(text).then(() => {
el.classList.add('copied');
setTimeout(() => el.classList.remove('copied'), 1200);
});
document.querySelectorAll('main div.highlight').forEach((block) => {
const b = document.createElement('button');
b.type = 'button';
b.className = 'copy';
b.addEventListener('mouseenter', () => { b.title = label('Copy', 'Copier'); });
b.addEventListener('click', () => copy(b, block.innerText.replace(/^\$ /gm, '').trimEnd()));
block.append(b);
});
document.querySelectorAll('main td > code').forEach((code) => {
if (!/^\d+\.\d+(\.\d+)?-v5-[a-z0-9-]+$/.test(code.textContent)) return;
code.classList.add('tag-copy');
code.tabIndex = 0;
code.setAttribute('role', 'button');
const go = () => copy(code, 'thecodingmachine/php:' + code.textContent);
code.addEventListener('mouseenter', () => { code.title = label('Copy thecodingmachine/php:', 'Copier thecodingmachine/php:') + code.textContent; });
code.addEventListener('click', go);
code.addEventListener('keydown', (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); go(); } });
});
})();
{%- if page.bilingual %}
// One page in both languages: the lang parameter of the URL hash picks French, English otherwise
(() => {
const titles = { en: {{ page.title | append: ' · ' | append: site.title | jsonify }}, fr: {{ page.title_fr | default: page.title | append: ' · ' | append: site.title | jsonify }} };
const apply = () => {
const lang = new URLSearchParams(location.hash.slice(1)).get('lang') === 'fr' ? 'fr' : 'en';
document.body.dataset.lang = lang;
document.documentElement.lang = lang;
document.title = titles[lang];
document.querySelectorAll('[data-set-lang]').forEach(a => a.toggleAttribute('aria-current', a.dataset.setLang === lang));
};
document.querySelectorAll('[data-set-lang]').forEach(a => a.addEventListener('click', (e) => {
e.preventDefault();
const h = new URLSearchParams(location.hash.slice(1));
h.set('lang', a.dataset.setLang);
location.hash = h.toString();
}));
window.addEventListener('hashchange', apply);
apply();
})();
{%- endif %}
</script>
{%- if page.name == 'images.md' %}
<script src="{{ '/assets/js/tag-picker.js' | relative_url }}"></script>
{%- endif %}
</body>
</html>
16 changes: 9 additions & 7 deletions docs/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ ID of this owner. The commands, Apache and PHP-FPM then run as `docker`:
- your PHP application can edit any file of your project;
- you can edit any file created by the container.

<figure><img src="assets/img/permissions.svg" alt="The docker user takes the UID of the owner of the mounted project" width="760"></figure>

If this ID is already used by a system account of the image (e.g. `998`, used by `systemd-network` in the image and
often by the `gitlab-runner` user on CI hosts), this system account is moved to another ID: the commands are still run
by the `docker` user.
Expand All @@ -31,14 +33,14 @@ them through a security hole, they can run any PHP code. Run Apache as `www-data

## NodeJS

The fat images have NodeJS variants (e.g. `thecodingmachine/php:8.4-v5-apache-node24`), see the
The fat images have NodeJS variants (e.g. `thecodingmachine/php:8.6-v5-apache-node24`), see the
[list of images](../README.md#images).

With a slim image, the `NODE_VERSION` ARG installs NodeJS (with npm and yarn) during the build:

```Dockerfile
ARG NODE_VERSION=24
FROM thecodingmachine/php:8.4-v5-slim-apache
FROM thecodingmachine/php:8.6-v5-slim-apache
```

The `ARG NODE_VERSION` instruction must be written before the `FROM`. This is not a typo.
Expand All @@ -60,7 +62,7 @@ during the build instead, with an ARG before the `FROM`:

```Dockerfile
ARG COMPOSER_VERSION=2.4.4
FROM thecodingmachine/php:8.4-v5-slim-apache
FROM thecodingmachine/php:8.6-v5-slim-apache
```

## Locales
Expand All @@ -79,7 +81,7 @@ the `FROM`:

```Dockerfile
ARG INSTALL_LOCALES=1
FROM thecodingmachine/php:8.4-v5-slim-apache
FROM thecodingmachine/php:8.6-v5-slim-apache
```

## SSH private keys
Expand All @@ -92,15 +94,15 @@ If your project depends on a [package stored in a private Git repository](https:
```yml
services:
my_app:
image: thecodingmachine/php:8.4-v5-apache
image: thecodingmachine/php:8.6-v5-apache
volumes:
- ~/.ssh:/home/docker/.ssh
```

**In a Dockerfile**, pass the key and the signature of the server (`ssh-keyscan myserver.com`) as build arguments:

```Dockerfile
FROM thecodingmachine/php:8.4-v5-apache
FROM thecodingmachine/php:8.6-v5-apache

ARG SSH_PRIVATE_KEY
ARG SSH_KNOWN_HOSTS
Expand Down Expand Up @@ -134,7 +136,7 @@ kind: Pod
spec:
containers:
- name: foobar
image: thecodingmachine/php:8.4-v5-apache
image: thecodingmachine/php:8.6-v5-apache
securityContext:
allowPrivilegeEscalation: true # never use "false" here
```
Expand Down
Loading