- update readme

- add script to build for any env
This commit is contained in:
Vincent BRIDIER 2021-12-09 19:40:02 +01:00
parent 70ee20c130
commit 28059d1ce5
11 changed files with 2080 additions and 3 deletions

47
PHP7.3/Build.sh Normal file
View file

@ -0,0 +1,47 @@
#!/bin/zsh
if [ -z "$1" ]; then
echo "NAME argument missing"
exit
fi
if [ -z "$2" ]; then
echo "ENV argument missing"
exit
fi
if [ -z "$3" ]; then
echo "VERSION argument missing"
exit
fi
NAME=$1
ENV=$2
VERSION=$3
TMPDOCKERFILE=Dockerfile
if test -f "$TMPDOCKERFILE"; then
rm $TMPDOCKERFILE
fi
cat src/common-header.txt > $TMPDOCKERFILE
if [ $ENV != "production" ]; then
cat src/dev-utils.txt >> $TMPDOCKERFILE
fi
cat src/common-copy.txt >> $TMPDOCKERFILE
if [ $ENV = "production" ]; then
echo "COPY conf/php-production.ini /usr/local/etc/php/conf.d/app.ini" >> $TMPDOCKERFILE
else
echo "COPY conf/php.ini /usr/local/etc/php/conf.d/app.ini" >> $TMPDOCKERFILE
fi
if [ $ENV = "local" ] || [ $ENV = "production" ]; then
echo "COPY conf/vhost.conf /etc/apache2/sites-available/000-default.conf" >> $TMPDOCKERFILE
else
echo "COPY conf/vhost-htaccess.conf /etc/apache2/sites-available/000-default.conf" >> $TMPDOCKERFILE
fi
cat src/common-footer.txt >> $TMPDOCKERFILE
docker build -t ${NAME}-${ENV}:${VERSION} .

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,25 @@
<VirtualHost *:80>
ServerAdmin contact@ldc.fr
ServerName ${SERVERNAME}
DocumentRoot /app/${DOCUMENTROOT}
<Directory /app/>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
php_admin_value open_basedir /app/
php_admin_value upload_tmp_dir /app/tmp
php_admin_value error_log /app/logs/app_error_${PROJECT}.log
AuthUserFile /etc/apache2/.sitepass
AuthName 'Auth Required'
AuthType Basic
Require valid-user
SetEnvIf X_FORWARDED_PROTO https HTTPS=on
</Directory>
ErrorLog /app/logs/error_${PROJECT}.log
CustomLog /app/logs/access_${PROJECT}.log combined
</VirtualHost>

View file

@ -2,16 +2,16 @@
## Build
Pour build une image, il faut faire la commande suivante :
Pour build une image, il faut faire la commande suivante dans le dossier PHP7.3 :
```sh
docker build -t [NOM IMAGE]:[VERSION IMAGE] .
sh Build.sh [NAME] [ENV] [VERSION]
```
Exemple :
```sh
docker build -t ldcweb-dev:1.0 .
sh Build.sh ldctest dev 1.0
```
## Paramètres obligatoires pour run l'image

View file

@ -0,0 +1,3 @@
COPY conf/common-apache.conf /etc/apache2/conf-available/z-app.conf
COPY conf/common-ports.conf /etc/apache2/ports.conf
COPY conf/common-security.conf /etc/apache2/conf-enabled/security.conf

View file

@ -0,0 +1,10 @@
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN useradd -ms /bin/bash noroot
RUN a2enmod rewrite remoteip headers && \
a2enconf z-app
USER noroot
WORKDIR /app/srcs

View file

@ -0,0 +1,43 @@
FROM php:7.3-apache
RUN apt-get update -qq && \
apt-get install -qy \
# Common
nano \
vim \
# GD
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libwebp-dev \
libxpm-dev \
# INTL
zlib1g-dev libicu-dev g++ \
# XSL
libxslt-dev \
# ZIP
libzip-dev \
unzip \
zip \
# Imagick
libmagick++-dev \
libmagickwand-dev \
# Memcached
libmemcached-dev
RUN docker-php-ext-configure gd \
--with-gd \
--with-webp-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-xpm-dir \
--with-freetype-dir
RUN docker-php-ext-configure intl
RUN docker-php-ext-configure zip --with-libzip
RUN docker-php-ext-install exif gd gettext intl mysqli pdo_mysql xsl opcache zip
RUN pecl install imagick-3.6.0 && docker-php-ext-enable imagick
RUN pecl install memcached-3.1.5 && docker-php-ext-enable memcached

9
PHP7.3/src/dev-utils.txt Normal file
View file

@ -0,0 +1,9 @@
# DEV
# TODO : https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/laravel + https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/vscode
RUN apt-get install -qy git zsh && sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
RUN pecl install xdebug && docker-php-ext-enable xdebug
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN curl -fsSL https://deb.nodesource.com/setup_17.x | bash -
RUN apt-get install -y nodejs
## DEV