Skip to content

Commit

Permalink
add 8.3 variant
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-sainthillier committed Apr 20, 2024
1 parent 6453d42 commit 842dfb1
Show file tree
Hide file tree
Showing 23 changed files with 573 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ jobs:
fail-fast: false
matrix:
path-and-tag:
- '8.2:latest'
- '8.3:latest'
- '8.3-ci:8.3-ci'
- '8.3:8.3'
- '8.3-symfony:8.3-symfony'
- '8.2-ci:8.2-ci'
- '8.2:8.2'
- '8.2-symfony:8.2-symfony'
Expand Down
41 changes: 41 additions & 0 deletions 8.3-ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM php:8.3-alpine

ENV COMPOSER_ALLOW_SUPERUSER=1

WORKDIR /app

# Install dependencies
RUN apk add --no-cache \
bash \
icu \
libxml2 \
libzip \
git \
zlib && \
#Composer
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
# Reduce layer size
rm -rf /var/cache/apk/* /tmp/*

# PHP Extensions
ENV PHPIZE_DEPS \
autoconf \
cmake \
file \
freetype-dev \
g++ \
gcc \
icu-dev \
libc-dev \
libzip-dev \
make \
pcre-dev \
pkgconf \
re2c \
zlib-dev

RUN apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS && \
docker-php-ext-install -j$(nproc) intl opcache zip && \
apk del .build-deps && \
rm -rf /var/cache/apk/* /tmp/*
32 changes: 32 additions & 0 deletions 8.3-symfony/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM php:8.3-apache

ENV COMPOSER_ALLOW_SUPERUSER=1

EXPOSE 80
WORKDIR /app

RUN apt-get update -qq && \
apt-get install -qy \
git \
gnupg \
libicu-dev \
libzip-dev \
unzip \
zip \
zlib1g-dev && \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# PHP Extensions
RUN docker-php-ext-configure zip && \
docker-php-ext-install -j$(nproc) intl opcache pdo_mysql zip
COPY conf/php.ini /usr/local/etc/php/conf.d/app.ini

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

RUN a2enmod rewrite remoteip && \
a2enconf z-app
34 changes: 34 additions & 0 deletions 8.3-symfony/conf/apache.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<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 172.17.0.0/12
RemoteIPInternalProxy 172.18.0.0/12
RemoteIPInternalProxy 172.19.0.0/12
RemoteIPInternalProxy 172.20.0.0/12
RemoteIPInternalProxy 172.21.0.0/12
RemoteIPInternalProxy 172.22.0.0/12
RemoteIPInternalProxy 192.168.0.0/16

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

Alias /_errors/ /errors/
ErrorDocument 404 /_errors/404.html
ErrorDocument 403 /_errors/403.html
ErrorDocument 500 /_errors/500.html
17 changes: 17 additions & 0 deletions 8.3-symfony/conf/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
date.timezone = Europe/Paris

opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 128
opcache.revalidate_freq = 0
apc.enable_cli = On

upload_max_filesize = 16M
post_max_size = 16M

realpath_cache_size = 4096k
realpath_cache_ttl = 7200

display_errors = Off
display_startup_errors = Off
error_log = /proc/self/fd/2
23 changes: 23 additions & 0 deletions 8.3-symfony/conf/vhost.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<VirtualHost *:80>
ServerAdmin [email protected]

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.3-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.3-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.3-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.3-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.3-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.3-symfony/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

phpinfo();
29 changes: 29 additions & 0 deletions 8.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM php:8.3-apache

ENV COMPOSER_ALLOW_SUPERUSER=1

EXPOSE 80
WORKDIR /app

# git, unzip & zip are for composer
RUN apt-get update -qq && \
apt-get install -qy \
git \
gnupg \
unzip \
zip && \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# PHP Extensions
RUN docker-php-ext-install -j$(nproc) opcache pdo_mysql
COPY conf/php.ini /usr/local/etc/php/conf.d/app.ini

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

RUN a2enmod rewrite remoteip && \
a2enconf z-app
34 changes: 34 additions & 0 deletions 8.3/conf/apache.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<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 172.17.0.0/12
RemoteIPInternalProxy 172.18.0.0/12
RemoteIPInternalProxy 172.19.0.0/12
RemoteIPInternalProxy 172.20.0.0/12
RemoteIPInternalProxy 172.21.0.0/12
RemoteIPInternalProxy 172.22.0.0/12
RemoteIPInternalProxy 192.168.0.0/16

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

Alias /_errors/ /errors/
ErrorDocument 404 /_errors/404.html
ErrorDocument 403 /_errors/403.html
ErrorDocument 500 /_errors/500.html
Loading

0 comments on commit 842dfb1

Please sign in to comment.