Added gettext, testing for artisan and enabled migrate before starting
This commit is contained in:
parent
2976938437
commit
2a35efec11
@ -3,7 +3,8 @@
|
||||
|
||||
FROM php:7.2-fpm
|
||||
|
||||
RUN apt-get update && apt-get install -y openssh-server ssmtp libpq-dev unzip git libssl1.0-dev libldap-dev && rm -rf /var/lib/apt/lists/* /tmp/* \
|
||||
RUN apt-get update && apt-get install -y openssh-server ssmtp libpq-dev unzip git libssl1.0-dev libldap-dev gettext \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* \
|
||||
&& useradd -c "Hosting Admin User" -u 1000 -g users -G www-data -d /var/www/html -M lamp \
|
||||
&& sed -i -e 's/^mailhub=mail$/mailhub=smtp/' -e "s/^hostname=/#hostname=/" -e 's/#FromLineOverride=YES/FromLineOverride=YES/' /etc/ssmtp/ssmtp.conf
|
||||
|
||||
@ -12,9 +13,9 @@ RUN (cd / && patch -p0 ) < /tmp/sshd_config.patch && rm /tmp/sshd_config.patch
|
||||
|
||||
EXPOSE 9000/tcp 22/tcp
|
||||
|
||||
RUN docker-php-ext-install -j$(nproc) pdo_mysql pdo_pgsql ldap
|
||||
RUN docker-php-ext-install -j$(nproc) pdo_mysql pdo_pgsql ldap gettext
|
||||
RUN curl https://getcomposer.org/installer|php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
COPY start /usr/local/sbin
|
||||
ENTRYPOINT [ "/usr/local/sbin/start" ]
|
||||
COPY init /sbin
|
||||
ENTRYPOINT [ "/sbin/init" ]
|
||||
CMD [ "php-fpm" ]
|
||||
|
14
start → init
14
start → init
@ -2,7 +2,7 @@
|
||||
|
||||
set -e
|
||||
role=${CONTAINER_ROLE:-app}
|
||||
env=${APP_ENV:-production}
|
||||
env=${APP_ENV:-live}
|
||||
|
||||
# General Setup
|
||||
if [ -x /usr/sbin/sshd -a "${SSH_START}" = "TRUE" ]; then
|
||||
@ -11,27 +11,29 @@ if [ -x /usr/sbin/sshd -a "${SSH_START}" = "TRUE" ]; then
|
||||
fi
|
||||
|
||||
# Laravel Specific
|
||||
if [ "${role}" = "app" ]; then
|
||||
if [ "${role}" = "app" -a -e artisan ]; then
|
||||
if [ "${env}" != "local" -a -r "artisan" ]; then
|
||||
# See if we need to refresh our dependancies
|
||||
if [[ -r composer.lock && ( -e .composer.refresh || ! -d vendor ) ]]; then
|
||||
su www-data -s /bin/sh -c "composer install" && ( test -e .composer.refresh && rm -f .composer.refresh )
|
||||
fi
|
||||
|
||||
echo "Running migration..."
|
||||
(php artisan migrate)
|
||||
echo "Caching configuration..."
|
||||
(php artisan config:cache && php artisan route:cache && php artisan view:cache)
|
||||
fi
|
||||
|
||||
exec /usr/local/bin/docker-php-entrypoint "$@"
|
||||
|
||||
elif [ "$role" = "queue" ]; then
|
||||
elif [ "$role" = "queue" -a -e artisan ]; then
|
||||
|
||||
echo "Running the queue..."
|
||||
# We'll delay starting in case the app is caching
|
||||
sleep 15
|
||||
php ${PHP_OPTIONS} artisan queue:work --verbose --tries=${WORK_TRIES:-1} --timeout=${WORK_TIMEOUT:-90} ${WORK_QUEUES:+--queue=${WORK_QUEUES}} ${WORK_MEMORY:+--memory=${WORK_MEMORY}}
|
||||
|
||||
elif [ "$role" = "scheduler" ]; then
|
||||
elif [ "$role" = "scheduler" -a -e artisan ]; then
|
||||
|
||||
echo "Running the scheduler..."
|
||||
# We'll delay starting in case the app is caching
|
||||
@ -43,6 +45,6 @@ elif [ "$role" = "scheduler" ]; then
|
||||
done
|
||||
|
||||
else
|
||||
echo "Could not match the container role \"${role}\""
|
||||
exit 1
|
||||
echo "NO container role \"${role}\", AND/OR no laravel install, just starting php-fpm"
|
||||
exec /usr/local/bin/docker-php-entrypoint "$@"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user