Browse Source

* src for workspace & php build

* user images from src
master
dimti 10 months ago
parent
commit
f68bf45fae
  1. 24
      .env.example
  2. 17
      docker-compose.base.yml
  3. 58
      dockerfiles/php-fpm/php73.Dockerfile
  4. 58
      dockerfiles/php-fpm/php74.Dockerfile
  5. 4
      dockerfiles/php-fpm/xdebug.sh
  6. 33
      dockerfiles/workspace/workspace73.Dockerfile
  7. 33
      dockerfiles/workspace/workspace74.Dockerfile
  8. 3
      dockerfiles/workspace/xdebug.sh
  9. 35
      src/.env
  10. 53
      src/docker-compose.base.yml
  11. 35
      src/docker-compose.yml
  12. 33
      src/dockerfiles/php-fpm/php.base.Dockerfile
  13. 7
      src/dockerfiles/php-fpm/php73.Dockerfile
  14. 7
      src/dockerfiles/php-fpm/php74.Dockerfile
  15. 0
      src/dockerfiles/php-fpm/xdebug.ini
  16. 0
      src/dockerfiles/workspace/aliases.sh
  17. 0
      src/dockerfiles/workspace/composer.json
  18. 21
      src/dockerfiles/workspace/workspace.base.Dockerfile
  19. 6
      src/dockerfiles/workspace/workspace73.Dockerfile
  20. 6
      src/dockerfiles/workspace/workspace74.Dockerfile
  21. 0
      src/dockerfiles/workspace/xdebug.ini

24
.env.example

@ -6,33 +6,9 @@ PROJECTS_DIR=/home/youruser/PhpstormProjects
WORKSPACE_PUID=1000
WORKSPACE_PGID=1000
WORKSPACE_TIMEZONE=Europe/Moscow
WORKSPACE_INSTALL_SSH=true
WORKSPACE_INSTALL_MYSQL_CLIENT=true
WORKSPACE_INSTALL_PYTHON=true
WORKSPACE_INSTALL_FSWATCH=false
WORKSPACE_INSTALL_PING=true
WORKSPACE_INSTALL_S3_MINIO_CLIENT=true
WORKSPACE_COMPOSER_VERSION=1
WORKSPACE_COMPOSER_GLOBAL_INSTALL=true
WORKSPACE_COMPOSER_AUTH=false
WORKSPACE_COMPOSER_REPO_PACKAGIST=
WORKSPACE_INSTALL_XDEBUG=false
WORKSPACE_INSTALL_WP_CLI=true
WORKSPACE_INSTALL_NODE=true
WORKSPACE_NODE_VERSION=lts/dubnium
WORKSPACE_NPM_REGISTRY=
WORKSPACE_INSTALL_GULP=true
WORKSPACE_INSTALL_YARN=true
WORKSPACE_YARN_VERSION=latest
### PHP-FPM #############################################
INSTALL_XDEBUG=true
INSTALL_REDIS=true
INSTALL_ZIP=true
INSTALL_BZ2=true
INSTALL_INTL=true
INSTALL_PGSQL=true
INSTALL_BCMATH=true
INSTALL_PEAR_MAIL=true
PHP_OPT_SHORT_OPEN_TAG=On
PHP_OPT_MAX_EXECUTION_TIME=600

17
docker-compose.base.yml

@ -46,23 +46,6 @@ services:
- PUID=${WORKSPACE_PUID}
- PGID=${WORKSPACE_PGID}
- TZ=${WORKSPACE_TIMEZONE}
- INSTALL_SSH=${WORKSPACE_INSTALL_SSH}
- INSTALL_MYSQL_CLIENT=${WORKSPACE_INSTALL_MYSQL_CLIENT}
- INSTALL_PYTHON=${WORKSPACE_INSTALL_PYTHON}
- INSTALL_FSWATCH=${WORKSPACE_INSTALL_FSWATCH}
- INSTALL_PING=${WORKSPACE_INSTALL_PING}
- INSTALL_S3_MINIO_CLIENT=${WORKSPACE_INSTALL_S3_MINIO_CLIENT}
- COMPOSER_VERSION=${WORKSPACE_COMPOSER_VERSION}
- COMPOSER_GLOBAL_INSTALL=${WORKSPACE_COMPOSER_GLOBAL_INSTALL}
- COMPOSER_REPO_PACKAGIST=${WORKSPACE_COMPOSER_REPO_PACKAGIST}
- INSTALL_XDEBUG=${WORKSPACE_INSTALL_XDEBUG}
- INSTALL_WP_CLI=${WORKSPACE_INSTALL_WP_CLI}
- INSTALL_NODE=${WORKSPACE_INSTALL_NODE}
- NODE_VERSION=${WORKSPACE_NODE_VERSION}
- NPM_REGISTRY=${WORKSPACE_NPM_REGISTRY}
- INSTALL_GULP=${WORKSPACE_INSTALL_GULP}
- INSTALL_YARN=${WORKSPACE_INSTALL_YARN}
- YARN_VERSION=${WORKSPACE_YARN_VERSION}
restart: always
volumes:
- ${PROJECTS_DIR}:/var/www

58
dockerfiles/php-fpm/php73.Dockerfile

@ -1,7 +1,55 @@
# syntax = edrevo/dockerfile-plus
FROM php:7.3-fpm
FROM dimti/php:7.3
INCLUDE+ ./php.base.Dockerfile
###########################################################################
# Redis and igbinary:
###########################################################################
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-webp-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd
ARG INSTALL_REDIS=false
COPY ./igbinary.ini /usr/local/etc/php/conf.d/igbinary.ini
RUN if [ ${INSTALL_REDIS} = true ]; then \
pecl install -a igbinary \
&& docker-php-ext-enable igbinary \
&& printf "yes\n" | pecl install redis \
&& docker-php-ext-enable redis \
;fi
###########################################################################
# Pear Mail and Mail_Mime:
###########################################################################
ARG INSTALL_PEAR_MAIL=false
RUN if [ ${INSTALL_PEAR_MAIL} = true ]; then \
pear install Mail && pear install Mail_Mime \
;fi
###########################################################################
# php.ini opts:
###########################################################################
# https://github.com/php/php-src/blob/master/php.ini-development
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
ARG PHP_OPT_SHORT_OPEN_TAG=Off
RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/g" "$PHP_INI_DIR/php.ini"
ARG PHP_OPT_MAX_EXECUTION_TIME=30
RUN sed -i "s/^max_execution_time = .*/max_execution_time = $PHP_OPT_MAX_EXECUTION_TIME/g" "$PHP_INI_DIR/php.ini"
ARG PHP_OPT_MEMORY_LIMIT=128M
RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" "$PHP_INI_DIR/php.ini"
ARG PHP_OPT_UPLOAD_MAX_FILESIZE=2M
RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini"
###########################################################################
# Locales:
###########################################################################
RUN apt update && \
apt install -y locales && \
sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
sed -i 's/# ru_RU.UTF-8 UTF-8/ru_RU.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen

58
dockerfiles/php-fpm/php74.Dockerfile

@ -1,7 +1,55 @@
# syntax = edrevo/dockerfile-plus
FROM php:7.4-fpm
FROM dimti/php:7.4
INCLUDE+ ./php.base.Dockerfile
###########################################################################
# Redis and igbinary:
###########################################################################
RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
&& docker-php-ext-install -j$(nproc) gd
ARG INSTALL_REDIS=false
COPY ./igbinary.ini /usr/local/etc/php/conf.d/igbinary.ini
RUN if [ ${INSTALL_REDIS} = true ]; then \
pecl install -a igbinary \
&& docker-php-ext-enable igbinary \
&& printf "yes\n" | pecl install redis \
&& docker-php-ext-enable redis \
;fi
###########################################################################
# Pear Mail and Mail_Mime:
###########################################################################
ARG INSTALL_PEAR_MAIL=false
RUN if [ ${INSTALL_PEAR_MAIL} = true ]; then \
pear install Mail && pear install Mail_Mime \
;fi
###########################################################################
# php.ini opts:
###########################################################################
# https://github.com/php/php-src/blob/master/php.ini-development
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
ARG PHP_OPT_SHORT_OPEN_TAG=Off
RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/g" "$PHP_INI_DIR/php.ini"
ARG PHP_OPT_MAX_EXECUTION_TIME=30
RUN sed -i "s/^max_execution_time = .*/max_execution_time = $PHP_OPT_MAX_EXECUTION_TIME/g" "$PHP_INI_DIR/php.ini"
ARG PHP_OPT_MEMORY_LIMIT=128M
RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" "$PHP_INI_DIR/php.ini"
ARG PHP_OPT_UPLOAD_MAX_FILESIZE=2M
RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini"
###########################################################################
# Locales:
###########################################################################
RUN apt update && \
apt install -y locales && \
sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
sed -i 's/# ru_RU.UTF-8 UTF-8/ru_RU.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen

4
dockerfiles/php-fpm/xdebug.sh

@ -2,10 +2,10 @@
# NOTE: At the moment, this has only been confirmed to work with PHP 7
PHP_VERSION=$1
PHP_VERSION=$1 # Without dot
# Grab full name of php-fpm container
PHP_FPM_CONTAINER=$(docker ps | grep php-fpm${PHP_VERSION} | awk '{print $1}')
PHP_FPM_CONTAINER=$(docker ps | grep php${PHP_VERSION} | awk '{print $1}')
# Grab OS type

33
dockerfiles/workspace/workspace73.Dockerfile

@ -1,9 +1,26 @@
# syntax = edrevo/dockerfile-plus
ARG PHP_VERSION=7.3
FROM dimti/workspace:7.3
FROM laradock/workspace:latest-${PHP_VERSION}
###########################################################################
# Laradock non-root user:
###########################################################################
ARG PUID=1000
ENV PUID ${PUID}
ARG PGID=1000
ENV PGID ${PGID}
RUN usermod -u ${PUID} laradock && groupmod -g ${PGID} laradock
RUN chown -R ${PUID}:${PGID} /home/laradock
###########################################################################
# Set Timezone
###########################################################################
ARG TZ=Europe/Moscow
ENV TZ ${TZ}
INCLUDE+ ./workspace.base.Dockerfile
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
###########################################################################
# Additional PHP-extensions:
@ -12,6 +29,14 @@ INCLUDE+ ./workspace.base.Dockerfile
RUN pecl install -a redis
###########################################################################
# S3 config
###########################################################################
USER laradock
COPY ./minio/auth.json /home/laradock/.mc/config.json
###########################################################################
# Crontab
###########################################################################

33
dockerfiles/workspace/workspace74.Dockerfile

@ -1,9 +1,26 @@
# syntax = edrevo/dockerfile-plus
ARG PHP_VERSION=7.4
FROM dimti/workspace:7.4
FROM laradock/workspace:latest-${PHP_VERSION}
###########################################################################
# Laradock non-root user:
###########################################################################
ARG PUID=1000
ENV PUID ${PUID}
ARG PGID=1000
ENV PGID ${PGID}
RUN usermod -u ${PUID} laradock && groupmod -g ${PGID} laradock
RUN chown -R ${PUID}:${PGID} /home/laradock
###########################################################################
# Set Timezone
###########################################################################
ARG TZ=Europe/Moscow
ENV TZ ${TZ}
INCLUDE+ ./workspace.base.Dockerfile
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
###########################################################################
# Additional PHP-extensions:
@ -13,6 +30,14 @@ RUN pecl install igbinary \
&& pecl install -a redis
###########################################################################
# S3 config
###########################################################################
USER laradock
COPY ./minio/auth.json /home/laradock/.mc/config.json
###########################################################################
# Crontab
###########################################################################

3
dockerfiles/workspace/xdebug.sh

@ -2,9 +2,10 @@
# NOTE: At the moment, this has only been confirmed to work with PHP 7
PHP_VERSION=$1 # Without dot
# Grab full name of workspace container
WORKSPACE_CONTAINER=$(docker ps | grep workspace | awk '{print $1}')
WORKSPACE_CONTAINER=$(docker ps | grep workspace${PHP_VERSION} | awk '{print $1}')
# Grab OS type

35
src/.env

@ -0,0 +1,35 @@
### WORKSPACE #############################################
WORKSPACE_PUID=1000
WORKSPACE_PGID=1000
WORKSPACE_TIMEZONE=Europe/Moscow
WORKSPACE_INSTALL_SSH=true
WORKSPACE_INSTALL_MYSQL_CLIENT=true
WORKSPACE_INSTALL_PYTHON=true
WORKSPACE_INSTALL_FSWATCH=false
WORKSPACE_INSTALL_PING=true
WORKSPACE_INSTALL_S3_MINIO_CLIENT=true
WORKSPACE_COMPOSER_VERSION=1
WORKSPACE_COMPOSER_GLOBAL_INSTALL=true
WORKSPACE_COMPOSER_REPO_PACKAGIST=
WORKSPACE_INSTALL_XDEBUG=false
WORKSPACE_INSTALL_WP_CLI=true
WORKSPACE_INSTALL_NODE=true
WORKSPACE_NODE_VERSION=lts/dubnium
WORKSPACE_NPM_REGISTRY=
WORKSPACE_INSTALL_GULP=true
WORKSPACE_INSTALL_YARN=true
WORKSPACE_YARN_VERSION=latest
### PHP-FPM #############################################
INSTALL_XDEBUG=true
INSTALL_REDIS=true
INSTALL_ZIP=true
INSTALL_BZ2=true
INSTALL_INTL=true
INSTALL_PGSQL=true
INSTALL_BCMATH=true
PHP_OPT_SHORT_OPEN_TAG=On
PHP_OPT_MAX_EXECUTION_TIME=600
PHP_OPT_MEMORY_LIMIT=500M
PHP_OPT_UPLOAD_MAX_FILESIZE=20M

53
src/docker-compose.base.yml

@ -0,0 +1,53 @@
version: '3.6'
services:
php-fpm:
build:
context: ./dockerfiles/php-fpm
args:
- INSTALL_XDEBUG=${INSTALL_XDEBUG}
- INSTALL_REDIS=${INSTALL_REDIS}
- INSTALL_ZIP=${INSTALL_ZIP}
- INSTALL_BZ2=${INSTALL_BZ2}
- INSTALL_INTL=${INSTALL_INTL}
- INSTALL_PGSQL=${INSTALL_PGSQL}
- INSTALL_BCMATH=${INSTALL_BCMATH}
- INSTALL_PEAR_MAIL=${INSTALL_PEAR_MAIL}
- PHP_OPT_SHORT_OPEN_TAG=${PHP_OPT_SHORT_OPEN_TAG}
- PHP_OPT_MAX_EXECUTION_TIME=${PHP_OPT_MAX_EXECUTION_TIME}
- PHP_OPT_MEMORY_LIMIT=${PHP_OPT_MEMORY_LIMIT}
- PHP_OPT_UPLOAD_MAX_FILESIZE=${PHP_OPT_UPLOAD_MAX_FILESIZE}
restart: always
volumes:
- ${PROJECTS_DIR}:/usr/share/nginx/html
expose:
- 9000
workspace:
build:
context: ./dockerfiles/workspace
args:
- PUID=${WORKSPACE_PUID}
- PGID=${WORKSPACE_PGID}
- TZ=${WORKSPACE_TIMEZONE}
- INSTALL_SSH=${WORKSPACE_INSTALL_SSH}
- INSTALL_MYSQL_CLIENT=${WORKSPACE_INSTALL_MYSQL_CLIENT}
- INSTALL_PYTHON=${WORKSPACE_INSTALL_PYTHON}
- INSTALL_FSWATCH=${WORKSPACE_INSTALL_FSWATCH}
- INSTALL_PING=${WORKSPACE_INSTALL_PING}
- INSTALL_S3_MINIO_CLIENT=${WORKSPACE_INSTALL_S3_MINIO_CLIENT}
- COMPOSER_VERSION=${WORKSPACE_COMPOSER_VERSION}
- COMPOSER_GLOBAL_INSTALL=${WORKSPACE_COMPOSER_GLOBAL_INSTALL}
- COMPOSER_REPO_PACKAGIST=${WORKSPACE_COMPOSER_REPO_PACKAGIST}
- INSTALL_XDEBUG=${WORKSPACE_INSTALL_XDEBUG}
- INSTALL_WP_CLI=${WORKSPACE_INSTALL_WP_CLI}
- INSTALL_NODE=${WORKSPACE_INSTALL_NODE}
- NODE_VERSION=${WORKSPACE_NODE_VERSION}
- NPM_REGISTRY=${WORKSPACE_NPM_REGISTRY}
- INSTALL_GULP=${WORKSPACE_INSTALL_GULP}
- INSTALL_YARN=${WORKSPACE_INSTALL_YARN}
- YARN_VERSION=${WORKSPACE_YARN_VERSION}
restart: always
volumes:
- ${PROJECTS_DIR}:/var/www
extra_hosts:
- "dockerhost:${DOCKER_HOST_IP}"

35
src/docker-compose.yml

@ -0,0 +1,35 @@
version: '3.6'
services:
php73:
extends:
file: docker-compose.base.yml
service: php-fpm
build:
dockerfile: php73.Dockerfile
php74:
extends:
file: docker-compose.base.yml
service: php-fpm
build:
dockerfile: php74.Dockerfile
workspace73:
extends:
file: docker-compose.base.yml
service: workspace
build:
dockerfile: workspace73.Dockerfile
workspace74:
extends:
file: docker-compose.base.yml
service: workspace
build:
dockerfile: workspace74.Dockerfile
secrets:
user_ssh_key:
file: ~/.ssh/id_rsa
user_known_hosts:
file: ~/.ssh/known_hosts
composer_auth:
file: ~/.composer/auth.json

33
dockerfiles/php-fpm/php.base.Dockerfile → src/dockerfiles/php-fpm/php.base.Dockerfile

@ -31,21 +31,6 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
;fi
###########################################################################
# Redis and igbinary:
###########################################################################
ARG INSTALL_REDIS=false
COPY ./igbinary.ini /usr/local/etc/php/conf.d/igbinary.ini
RUN if [ ${INSTALL_REDIS} = true ]; then \
pecl install -a igbinary \
&& docker-php-ext-enable igbinary \
&& printf "yes\n" | pecl install redis \
&& docker-php-ext-enable redis \
;fi
###########################################################################
# Zip:
###########################################################################
@ -104,14 +89,11 @@ RUN if [ ${INSTALL_BCMATH} = true ]; then \
;fi
###########################################################################
# Pear Mail and Mail_Mime:
# Prepend nginx 502 on showing errors:
# @see https://stackoverflow.com/questions/55260221/laravel-php-7-3-nginx-502-upstream-prematurely-closed-fastcgi-stdout
###########################################################################
ARG INSTALL_PEAR_MAIL=false
RUN if [ ${INSTALL_PEAR_MAIL} = true ]; then \
pear install Mail && pear install Mail_Mime \
;fi
RUN sed -i "s/^log_limit = .*/log_limit = 1024/g" "$PHP_INI_DIR/../php-fpm.d/docker.conf"
###########################################################################
# php.ini opts:
@ -134,13 +116,6 @@ RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MA
###########################################################################
# Prepend nginx 502 on showing errors:
# @see https://stackoverflow.com/questions/55260221/laravel-php-7-3-nginx-502-upstream-prematurely-closed-fastcgi-stdout
###########################################################################
RUN sed -i "s/^log_limit = .*/log_limit = 1024/g" "$PHP_INI_DIR/../php-fpm.d/docker.conf"
###########################################################################
# Locales:
###########################################################################
@ -148,4 +123,4 @@ RUN apt update && \
apt install -y locales && \
sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
sed -i 's/# ru_RU.UTF-8 UTF-8/ru_RU.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen
locale-gen

7
src/dockerfiles/php-fpm/php73.Dockerfile

@ -0,0 +1,7 @@
# syntax = edrevo/dockerfile-plus
FROM php:7.3-fpm
INCLUDE+ ./php.base.Dockerfile
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-webp-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd

7
src/dockerfiles/php-fpm/php74.Dockerfile

@ -0,0 +1,7 @@
# syntax = edrevo/dockerfile-plus
FROM php:7.4-fpm
INCLUDE+ ./php.base.Dockerfile
RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
&& docker-php-ext-install -j$(nproc) gd

0
dockerfiles/php-fpm/xdebug.ini → src/dockerfiles/php-fpm/xdebug.ini

0
dockerfiles/workspace/aliases.sh → src/dockerfiles/workspace/aliases.sh

0
dockerfiles/workspace/composer.json → src/dockerfiles/workspace/composer.json

21
dockerfiles/workspace/workspace.base.Dockerfile → src/dockerfiles/workspace/workspace.base.Dockerfile

@ -420,27 +420,6 @@ RUN if [ ${INSTALL_YARN} = true ]; then \
# Add PATH for YARN
ENV PATH $PATH:/home/laradock/.yarn/bin
###########################################################################
# S3 config helper
###########################################################################
USER laradock
COPY ./minio/auth.json /home/laradock/.mc/config.json
###########################################################################
# Add known hosts
###########################################################################
USER laradock
RUN if [ ${INSTALL_SSH} = true ]; then \
&& ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts \
&& ssh-keyscan -t rsa bitbucket.org >> ~/.ssh/known_hosts \
&& ssh-keyscan -t rsa gitlab.com >> ~/.ssh/known_hosts \
&& ssh-keyscan -t rsa vcs.wpstudio.ru >> ~/.ssh/known_hosts \
;fi
#
#--------------------------------------------------------------------------
# Final Touch

6
src/dockerfiles/workspace/workspace73.Dockerfile

@ -0,0 +1,6 @@
# syntax = edrevo/dockerfile-plus
ARG PHP_VERSION=7.3
FROM laradock/workspace:latest-${PHP_VERSION}
INCLUDE+ ./workspace.base.Dockerfile

6
src/dockerfiles/workspace/workspace74.Dockerfile

@ -0,0 +1,6 @@
# syntax = edrevo/dockerfile-plus
ARG PHP_VERSION=7.4
FROM laradock/workspace:latest-${PHP_VERSION}
INCLUDE+ ./workspace.base.Dockerfile

0
dockerfiles/workspace/xdebug.ini → src/dockerfiles/workspace/xdebug.ini

Loading…
Cancel
Save