Browse Source
+ php 8.1
+ php 8.1
* refactoring composer version & auth secrets apply separate for workspacesmaster
dimti
2 years ago
26 changed files with 390 additions and 74 deletions
-
6docker-compose.base.yml
-
24docker-compose.yml.example
-
52dockerfiles/php-fpm/php81.Dockerfile
-
0dockerfiles/php-fpm/xdebug2/xdebug.ini
-
0dockerfiles/php-fpm/xdebug2/xdebug.sh
-
26dockerfiles/php-fpm/xdebug3/xdebug.ini
-
87dockerfiles/php-fpm/xdebug3/xdebug.sh
-
3dockerfiles/workspace/.gitignore
-
0dockerfiles/workspace/crontab-example/laradock
-
0dockerfiles/workspace/laradock.example
-
2dockerfiles/workspace/workspace73.Dockerfile
-
2dockerfiles/workspace/workspace74.Dockerfile
-
113dockerfiles/workspace/workspace81.Dockerfile
-
16get-composer-auth.sh
-
5src/.env
-
3src/docker-compose.base.yml
-
16src/docker-compose.yml
-
2src/dockerfiles/php-fpm/php.base.Dockerfile
-
7src/dockerfiles/php-fpm/php81.Dockerfile
-
5src/dockerfiles/workspace/composer.json
-
16src/dockerfiles/workspace/composer1.Dockerfile
-
16src/dockerfiles/workspace/composer2.Dockerfile
-
53src/dockerfiles/workspace/workspace.base.Dockerfile
-
1src/dockerfiles/workspace/workspace73.Dockerfile
-
1src/dockerfiles/workspace/workspace74.Dockerfile
-
8src/dockerfiles/workspace/workspace81.Dockerfile
@ -0,0 +1,52 @@ |
|||
FROM dimti/php:8.1 |
|||
|
|||
########################################################################### |
|||
# 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 |
|||
|
|||
########################################################################### |
|||
# 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 |
|||
|
|||
########################################################################### |
|||
# xDebug (termporary): |
|||
########################################################################### |
|||
|
|||
# Copy xdebug configuration for remote debugging |
|||
COPY ./xdebug3/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini |
|||
|
|||
########################################################################### |
|||
# Tune opts: |
|||
########################################################################### |
|||
|
|||
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=600 |
|||
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=256M |
|||
RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" "$PHP_INI_DIR/php.ini" |
|||
|
|||
ARG PHP_OPT_POST_MAX_SIZE=48M |
|||
RUN sed -i "s/^post_max_size = .*/post_max_size = $PHP_OPT_POST_MAX_SIZE/g" "$PHP_INI_DIR/php.ini" |
|||
|
|||
ARG PHP_OPT_UPLOAD_MAX_FILESIZE=16M |
|||
RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini" |
@ -0,0 +1,26 @@ |
|||
; NOTE: The actual xdebug.so extention is NOT SET HERE but rather (/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini) |
|||
|
|||
;xdebug.remote_host=dockerhost |
|||
xdebug.remote_connect_back=1 |
|||
xdebug.remote_port=9000 |
|||
xdebug.idekey=PHPSTORM |
|||
|
|||
xdebug.remote_autostart=1 |
|||
xdebug.remote_enable=1 |
|||
xdebug.cli_color=0 |
|||
xdebug.profiler_enable=1 |
|||
xdebug.profiler_enable_trigger=1 |
|||
xdebug.profiler_output_dir=/tmp/profiler |
|||
|
|||
xdebug.remote_handler=dbgp |
|||
xdebug.remote_mode=req |
|||
|
|||
xdebug.var_display_max_children=-1 |
|||
xdebug.var_display_max_data=-1 |
|||
xdebug.var_display_max_depth=-1 |
|||
|
|||
xdebug.trace_enable_trigger=1 |
|||
xdebug.trace_output_dir=/tmp/trace |
|||
xdebug.trace_output_name="trace.%t" |
|||
|
|||
xdebug.show_exception_trace=1 |
@ -0,0 +1,87 @@ |
|||
#! /bin/bash |
|||
|
|||
# NOTE: At the moment, this has only been confirmed to work with PHP 7 |
|||
|
|||
PHP_VERSION=$2 # Without dot |
|||
WITH_PROFILER=$3 |
|||
|
|||
# Grab full name of php-fpm container |
|||
PHP_FPM_CONTAINER=$(docker ps | grep php${PHP_VERSION} | awk '{print $1}') |
|||
|
|||
if [[ -z "${PHP_FPM_CONTAINER}" ]]; then |
|||
echo "Unable to find php fpm container: php${PHP_VERSION}" |
|||
exit 1 |
|||
fi |
|||
|
|||
if [[ ! -z "${WITH_PROFILER}" ]]; then |
|||
echo "With profiler option". |
|||
fi |
|||
|
|||
xdebug_status () |
|||
{ |
|||
echo 'xDebug status' |
|||
|
|||
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' |
|||
} |
|||
|
|||
|
|||
xdebug_start () |
|||
{ |
|||
echo 'Start xDebug' |
|||
|
|||
# And uncomment line with xdebug extension, thus enabling it |
|||
ON_CMD="sed -i 's/^;zend_extension=/zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini" |
|||
REMOTE_AUTOSTART_CMD="sed -i 's/^xdebug.remote_autostart=0/xdebug.remote_autostart=1/g' /usr/local/etc/php/conf.d/xdebug.ini" |
|||
REMOTE_ENABLE_CMD="sed -i 's/^xdebug.remote_enable=0/xdebug.remote_enable=1/g' /usr/local/etc/php/conf.d/xdebug.ini" |
|||
PROFILER_ENABLE_CDM="sed -i 's/^xdebug.profiler_enable=0/xdebug.profiler_enable=1/g' /usr/local/etc/php/conf.d/xdebug.ini" |
|||
|
|||
docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}" |
|||
docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_AUTOSTART_CMD}" |
|||
docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_ENABLE_CMD}" |
|||
if [[ ! -z "${WITH_PROFILER}" ]]; then |
|||
docker exec -it $PHP_FPM_CONTAINER bash -c "${PROFILER_ENABLE_CDM}" |
|||
fi |
|||
docker restart $PHP_FPM_CONTAINER |
|||
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' |
|||
} |
|||
|
|||
|
|||
xdebug_stop () |
|||
{ |
|||
echo 'Stop xDebug' |
|||
|
|||
# Comment out xdebug extension line |
|||
OFF_CMD="sed -i 's/^zend_extension=/;zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini" |
|||
REMOTE_AUTOSTART_CMD="sed -i 's/^xdebug.remote_autostart=1/xdebug.remote_autostart=0/g' /usr/local/etc/php/conf.d/xdebug.ini" |
|||
REMOTE_ENABLE_CMD="sed -i 's/^xdebug.remote_enable=1/xdebug.remote_enable=0/g' /usr/local/etc/php/conf.d/xdebug.ini" |
|||
PROFILER_DISABLE_CMD="sed -i 's/^xdebug.profiler_enable=1/xdebug.profiler_enable=0/g' /usr/local/etc/php/conf.d/xdebug.ini" |
|||
|
|||
docker exec -it $PHP_FPM_CONTAINER bash -c "${OFF_CMD}" |
|||
docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_AUTOSTART_CMD}" |
|||
docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_ENABLE_CMD}" |
|||
docker exec -it $PHP_FPM_CONTAINER bash -c "${PROFILER_DISABLE_CMD}" |
|||
# docker-compose restart php-fpm |
|||
docker restart $PHP_FPM_CONTAINER |
|||
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' |
|||
} |
|||
|
|||
|
|||
case $1 in |
|||
stop|STOP) |
|||
xdebug_stop |
|||
;; |
|||
start|START) |
|||
xdebug_start |
|||
;; |
|||
status|STATUS) |
|||
xdebug_status |
|||
;; |
|||
*) |
|||
echo "xDebug [Stop | Start | Status] in the ${PHP_FPM_CONTAINER} container." |
|||
echo "xDebug must have already been installed." |
|||
echo "Usage:" |
|||
echo " .php-fpm/xdebug.sh 73|74 stop|start|status" |
|||
|
|||
esac |
|||
|
|||
exit 1 |
@ -1 +1,2 @@ |
|||
/aliases.sh |
|||
/aliases.sh |
|||
/crontab |
@ -0,0 +1,113 @@ |
|||
FROM dimti/workspace:8.1 |
|||
|
|||
ARG PHP_VERSION=8.1 |
|||
|
|||
########################################################################### |
|||
# Laradock non-root user: |
|||
########################################################################### |
|||
|
|||
ARG CUSTOM_PUID=1000 |
|||
ENV PUID ${CUSTOM_PUID} |
|||
ARG CUSTOM_PGID=1000 |
|||
ENV PGID ${CUSTOM_PGID} |
|||
|
|||
RUN usermod -u ${CUSTOM_PUID} laradock && groupmod -g ${CUSTOM_PGID} laradock |
|||
|
|||
RUN chown -R ${CUSTOM_PUID}:${CUSTOM_PGID} /home/laradock |
|||
|
|||
########################################################################### |
|||
# Set Timezone |
|||
########################################################################### |
|||
|
|||
ARG CUSTOM_TZ=Europe/Moscow |
|||
ENV TZ ${CUSTOM_TZ} |
|||
|
|||
RUN ln -snf /usr/share/zoneinfo/$CUSTOM_TZ /etc/localtime && echo $CUSTOM_TZ > /etc/timezone |
|||
|
|||
########################################################################### |
|||
# Additional PHP-extensions: |
|||
########################################################################### |
|||
|
|||
#RUN pecl install igbinary && pecl install -a redis |
|||
RUN pecl install -a redis |
|||
|
|||
RUN echo "extension=redis.so" > /etc/php/${PHP_VERSION}/cli/conf.d/20-redis.ini |
|||
|
|||
########################################################################### |
|||
# Update composer version |
|||
########################################################################### |
|||
|
|||
USER root |
|||
|
|||
ARG COMPOSER_VERSION=2 |
|||
ENV COMPOSER_VERSION ${COMPOSER_VERSION} |
|||
RUN composer self-update --${COMPOSER_VERSION} |
|||
|
|||
########################################################################### |
|||
# Install custom node version |
|||
########################################################################### |
|||
|
|||
USER root |
|||
|
|||
ARG CUSTOM_NODE_VERSION |
|||
ENV CUSTOM_NODE_VERSION ${CUSTOM_NODE_VERSION} |
|||
|
|||
RUN if [ ! -z "${CUSTOM_NODE_VERSION}" ]; then \ |
|||
. ~/.bashrc && nvm install ${CUSTOM_NODE_VERSION} \ |
|||
&& . ~/.bashrc && nvm alias default ${CUSTOM_NODE_VERSION} \ |
|||
&& cp -R ~/.nvm/alias /home/laradock/.nvm \ |
|||
&& cp -R ~/.nvm/versions /home/laradock/.nvm \ |
|||
&& chown -R ${CUSTOM_PUID}:${CUSTOM_PGID} /home/laradock/.nvm \ |
|||
;fi |
|||
|
|||
########################################################################### |
|||
# Laradock Aliases |
|||
########################################################################### |
|||
|
|||
USER laradock |
|||
|
|||
COPY ./aliases.sh /home/laradock/aliases.sh |
|||
|
|||
RUN echo "" >> ~/.bashrc && \ |
|||
echo "# Load Custom Aliases" >> ~/.bashrc && \ |
|||
echo "source ~/aliases.sh" >> ~/.bashrc && \ |
|||
echo "" >> ~/.bashrc |
|||
|
|||
########################################################################### |
|||
# S3 config |
|||
########################################################################### |
|||
|
|||
USER laradock |
|||
|
|||
COPY ./minio/auth.json /home/laradock/.mc/config.json |
|||
|
|||
########################################################################### |
|||
# Tune opts: |
|||
########################################################################### |
|||
|
|||
USER root |
|||
|
|||
ARG PHP_OPT_SHORT_OPEN_TAG=Off |
|||
RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/g" /etc/php/${PHP_VERSION}/cli/php.ini |
|||
|
|||
ARG PHP_OPT_MAX_EXECUTION_TIME=600 |
|||
RUN sed -i "s/^max_execution_time = .*/max_execution_time = $PHP_OPT_MAX_EXECUTION_TIME/g" /etc/php/${PHP_VERSION}/cli/php.ini |
|||
|
|||
ARG PHP_OPT_MEMORY_LIMIT=256M |
|||
RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" /etc/php/${PHP_VERSION}/cli/php.ini |
|||
|
|||
ARG PHP_OPT_POST_MAX_SIZE=48M |
|||
RUN sed -i "s/^post_max_size = .*/post_max_size = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" /etc/php/${PHP_VERSION}/cli/php.ini |
|||
|
|||
ARG PHP_OPT_UPLOAD_MAX_FILESIZE=16M |
|||
RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" /etc/php/${PHP_VERSION}/cli/php.ini |
|||
|
|||
########################################################################### |
|||
# Crontab |
|||
########################################################################### |
|||
|
|||
USER root |
|||
|
|||
COPY ./crontab /etc/cron.d |
|||
|
|||
RUN chmod -R 644 /etc/cron.d |
@ -1,15 +1,15 @@ |
|||
#!/bin/bash |
|||
FILE=${HOME}/.config/composer/auth.json |
|||
|
|||
if [[ -f "${FILE}" ]]; then |
|||
if [[ ! -z "$(cat $FILE | grep github)" ]]; then |
|||
exit 0 |
|||
fi |
|||
fi |
|||
#FILE=${HOME}/.config/composer/auth.json |
|||
# |
|||
#if [[ -f "${FILE}" ]]; then |
|||
# if [[ ! -z "$(cat $FILE | grep github)" ]]; then |
|||
# exit 0 |
|||
# fi |
|||
#fi |
|||
|
|||
echo "Get token: https://github.com/settings/tokens/new?scopes=repo&description=Composer" |
|||
|
|||
# user="USER INPUT" |
|||
read -p "Enter token: " TOKEN |
|||
|
|||
composer config -g github-oauth.github.com ${TOKEN} |
|||
composer config -g github-oauth.github.com ${TOKEN} |
@ -0,0 +1,7 @@ |
|||
# syntax = edrevo/dockerfile-plus |
|||
FROM php:8.1-fpm |
|||
|
|||
INCLUDE+ ./php.base.Dockerfile |
|||
|
|||
RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \ |
|||
&& docker-php-ext-install -j$(nproc) gd |
@ -1,5 +0,0 @@ |
|||
{ |
|||
"require": { |
|||
|
|||
} |
|||
} |
@ -0,0 +1,16 @@ |
|||
########################################################################### |
|||
# Composer: |
|||
########################################################################### |
|||
|
|||
USER laradock |
|||
|
|||
# Create composer dir for store composer2_auth secret |
|||
RUN mkdir -p /home/laradock/.composer |
|||
|
|||
USER root |
|||
|
|||
# Symlink to composer auth secret |
|||
RUN ln -s /run/secrets/composer1_auth /home/laradock/.composer/auth.json |
|||
|
|||
# Chooce composer version |
|||
RUN composer self-update --1 |
@ -0,0 +1,16 @@ |
|||
########################################################################### |
|||
# Composer: |
|||
########################################################################### |
|||
|
|||
USER laradock |
|||
|
|||
# Create composer dir for store composer2_auth secret |
|||
RUN mkdir -p /home/laradock/.config/composer |
|||
|
|||
USER root |
|||
|
|||
# Symlink to composer auth secret |
|||
RUN ln -s /run/secrets/composer2_auth /home/laradock/.config/composer/auth.json |
|||
|
|||
# Chooce composer version |
|||
RUN composer self-update --2 |
@ -0,0 +1,8 @@ |
|||
# syntax = edrevo/dockerfile-plus |
|||
FROM laradock/workspace:latest-8.1 |
|||
|
|||
ARG PHP_VERSION=8.1 |
|||
ENV PHP_VERSION ${PHP_VERSION} |
|||
|
|||
INCLUDE+ ./workspace.base.Dockerfile |
|||
INCLUDE+ ./composer2.Dockerfile |
Write
Preview
Loading…
Cancel
Save
Reference in new issue