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
6 changes: 6 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ jobs:
matrix:
arch: [amd64, arm64]
image: &images
- path: '8.6'
tags: silarhi/php-apache:8.6
- path: '8.6-ci'
tags: silarhi/php-apache:8.6-ci
- path: '8.6-symfony'
tags: silarhi/php-apache:8.6-symfony
- path: '8.5'
tags: |
silarhi/php-apache:latest
Expand Down
18 changes: 18 additions & 0 deletions 8.6-ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM mlocati/php-extension-installer:latest AS php-extension-installer
FROM php:8.6-rc-alpine

ENV COMPOSER_ALLOW_SUPERUSER=1

WORKDIR /app

SHELL ["/bin/ash", "-o", "pipefail", "-c"]

# Install dependencies
RUN apk add --no-cache \
bash \
git \
icu

# PHP Extensions
COPY --from=php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN install-php-extensions @composer intl opcache zip
37 changes: 37 additions & 0 deletions 8.6-symfony/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM mlocati/php-extension-installer:latest AS php-extension-installer
FROM php:8.6-rc-apache

ENV COMPOSER_ALLOW_SUPERUSER=1
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0

EXPOSE 80
WORKDIR /app

HEALTHCHECK --interval=1m --timeout=3s --start-period=5s --start-interval=1s --retries=3 \
CMD ["/bin/sh", "-c", "curl -f http://localhost/_health || exit 1"]

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN apt-get update -qq && \
apt-get install -qy \
git \
gnupg \
unzip \
zip && \
apt-get clean && rm -rf /var/lib/apt/lists/*

# PHP Extensions
COPY --from=php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN install-php-extensions @composer intl opcache pdo_mysql zip
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
COPY --link conf/php.ini $PHP_INI_DIR/conf.d/app.ini

# Apache
COPY --link errors /errors
COPY --link health.php /health/index.php
COPY --link conf/vhost.conf /etc/apache2/sites-available/000-default.conf
COPY --link conf/apache.conf /etc/apache2/conf-available/z-app.conf
COPY --link index.php /app/index.php

RUN a2enmod rewrite remoteip && \
a2enconf z-app
64 changes: 64 additions & 0 deletions 8.6-symfony/conf/apache.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<Directory /app/>
Options -Indexes +FollowSymLinks
AllowOverride None
Require all granted

SetEnvIf X-Forwarded-Proto "^https$" HTTPS=on
</Directory>

ServerTokens Prod
ServerSignature Off

LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined

RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 10.0.0.0/8
RemoteIPInternalProxy 172.16.0.0/12
RemoteIPInternalProxy 192.168.0.0/16
RemoteIPInternalProxy 169.254.0.0/16
RemoteIPInternalProxy 127.0.0.0/8
RemoteIPInternalProxy ::1

# Add Cloudflare IP ranges
RemoteIPTrustedProxy 173.245.48.0/20
RemoteIPTrustedProxy 103.21.244.0/22
RemoteIPTrustedProxy 103.22.200.0/22
RemoteIPTrustedProxy 103.31.4.0/22
RemoteIPTrustedProxy 141.101.64.0/18
RemoteIPTrustedProxy 108.162.192.0/18
RemoteIPTrustedProxy 190.93.240.0/20
RemoteIPTrustedProxy 188.114.96.0/20
RemoteIPTrustedProxy 197.234.240.0/22
RemoteIPTrustedProxy 198.41.128.0/17
RemoteIPTrustedProxy 162.158.0.0/15
RemoteIPTrustedProxy 104.16.0.0/13
RemoteIPTrustedProxy 104.24.0.0/14
RemoteIPTrustedProxy 172.64.0.0/13
RemoteIPTrustedProxy 131.0.72.0/22
RemoteIPTrustedProxy 2400:cb00::/32
RemoteIPTrustedProxy 2606:4700::/32
RemoteIPTrustedProxy 2803:f800::/32
RemoteIPTrustedProxy 2405:b500::/32
RemoteIPTrustedProxy 2405:8100::/32
RemoteIPTrustedProxy 2a06:98c0::/29
RemoteIPTrustedProxy 2c0f:f248::/32

<Directory /errors/>
Options -Indexes
AllowOverride None
Require all granted
</Directory>

<Directory /health/>
Options -Indexes
AllowOverride None
Require local
</Directory>

Alias /_errors/ /errors/
<Location "/_health">
Alias "/health/index.php"
</Location>
ErrorDocument 404 /_errors/404.html
ErrorDocument 403 /_errors/403.html
ErrorDocument 500 /_errors/500.html
23 changes: 23 additions & 0 deletions 8.6-symfony/conf/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
date.timezone = Europe/Paris

opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 256
opcache.interned_strings_buffer = 16
opcache.max_accelerated_files = 20000
; Files are compiled once and never checked again: restart PHP to deploy new code, or set
; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place.
opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS}
opcache.revalidate_freq = 0
apc.enable_cli = On

upload_max_filesize = 16M
post_max_size = 16M

realpath_cache_size = 4096k
realpath_cache_ttl = 7200

expose_php = Off
display_errors = Off
display_startup_errors = Off
error_log = /proc/self/fd/2
23 changes: 23 additions & 0 deletions 8.6-symfony/conf/vhost.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<VirtualHost *:80>
ServerAdmin hello@silarhi.fr

DocumentRoot /app/public

<Directory /app/public>
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /index.php/
</IfModule>
</IfModule>
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
20 changes: 20 additions & 0 deletions 8.6-symfony/errors/403.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="width=device-width, initial-scale=1" name="viewport">
<title>Erreur 403 (Interdit)</title>

<link href="/_errors/css/style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="error-box">
<div id="error-image"></div>
<h1>403</h1>
<h2>Accès interdit.</h2>
<p>L'accès à cette page requiert une autorisation.</p>
<a href="/">Retour à la page d'accueil</a>
</div>
</body>
</html>
20 changes: 20 additions & 0 deletions 8.6-symfony/errors/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="width=device-width, initial-scale=1" name="viewport">
<title>Erreur 404 (Introuvable)</title>

<link href="/_errors/css/style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="error-box">
<div id="error-image"></div>
<h1>404</h1>
<h2>Oops! Vous êtes perdu.</h2>
<p>La page que vous demandez est introuvable. Elle a peut-être été supprimée ou déplacée.</p>
<a href="/">Retour à la page d'accueil</a>
</div>
</body>
</html>
20 changes: 20 additions & 0 deletions 8.6-symfony/errors/500.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="width=device-width, initial-scale=1" name="viewport">
<title>Erreur 500 (Inaccessible)</title>

<link href="/_errors/css/style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="error-box">
<div id="error-image"></div>
<h1>500</h1>
<h2>Huston, on a un problème !</h2>
<p>La page que vous demandez est temporairement inaccessible.</p>
<a href="/">Retour à la page d'accueil</a>
</div>
</body>
</html>
102 changes: 102 additions & 0 deletions 8.6-symfony/errors/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
html {
box-sizing: border-box;
font-size: 16px;
}

*, *:before, *:after {
box-sizing: inherit;
}

body, h1, h2, h3, h4, h5, h6, p, ol, ul {
margin: 0;
padding: 0;
font-weight: normal;
}

ol, ul {
list-style: none;
}

html, body {
height: 100%;
}

body {
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}

#error-box {
position: relative;
max-width: 560px;
width: 100%;
padding-left: 160px;
line-height: 1.1;
}

#error-box #error-image {
position: absolute;
left: 0;
top: 0;
display: inline-block;
width: 140px;
height: 140px;
background-image: url('/_errors/img/emoji.png');
background-size: cover;
}

#error-box #error-image:before {
content: '';
position: absolute;
width: 100%;
height: 100%;
transform: scale(2.4);
border-radius: 50%;
background-color: #f2f5f8;
z-index: -1;
}

#error-box h1 {
font-size: 65px;
font-weight: 700;
margin-top: 0;
margin-bottom: 10px;
color: #151723;
text-transform: uppercase;
}

#error-box h2 {
font-size: 21px;
font-weight: 400;
margin: 0 0 1rem 0;
text-transform: uppercase;
color: #151723;
}

#error-box p {
color: #999fa5;
font-weight: 400;
margin-bottom: 1rem;
}

#error-box a {
font-weight: 500;
text-decoration: none;
color: #388dbc;
}

@media only screen and (max-width: 767px) {
#error-box #error-image {
width: 110px;
height: 110px;
}

#error-box {
padding-left: 15px;
padding-right: 15px;
padding-top: 110px;
}
}
Binary file added 8.6-symfony/errors/img/emoji.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions 8.6-symfony/health.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

http_response_code(204);
3 changes: 3 additions & 0 deletions 8.6-symfony/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

phpinfo();
38 changes: 38 additions & 0 deletions 8.6/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM mlocati/php-extension-installer:latest AS php-extension-installer
FROM php:8.6-rc-apache

ENV COMPOSER_ALLOW_SUPERUSER=1
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0

EXPOSE 80
WORKDIR /app

HEALTHCHECK --interval=1m --timeout=3s --start-period=5s --start-interval=1s --retries=3 \
CMD ["/bin/sh", "-c", "curl -f http://localhost/_health || exit 1"]

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# git, unzip & zip are for composer
RUN apt-get update -qq && \
apt-get install -qy \
git \
gnupg \
unzip \
zip && \
apt-get clean && rm -rf /var/lib/apt/lists/*

# PHP Extensions
COPY --from=php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN install-php-extensions @composer opcache pdo_mysql
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
COPY --link conf/php.ini $PHP_INI_DIR/conf.d/app.ini

# Apache
COPY --link errors /errors
COPY --link health.php /health/index.php
COPY --link conf/vhost.conf /etc/apache2/sites-available/000-default.conf
COPY --link conf/apache.conf /etc/apache2/conf-available/z-app.conf
COPY --link index.php /app/index.php

RUN a2enmod rewrite remoteip && \
a2enconf z-app
Loading
Loading