fix(dockerfile): cron
This commit is contained in:
parent
8a5331f2c5
commit
e5ef7b7004
1 changed files with 27 additions and 15 deletions
42
Dockerfile
42
Dockerfile
|
@ -308,7 +308,8 @@ RUN set -eux && \
|
|||
libpng-dev \
|
||||
git \
|
||||
libonig-dev \
|
||||
libpq-dev && \
|
||||
libpq-dev \
|
||||
cron && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
@ -325,6 +326,12 @@ RUN set -eux && useradd -G www-data -u $sintonia_uid -d /home/$sintonia_user $si
|
|||
chown -R $sintonia_user:$sintonia_user /home/$sintonia_user && \
|
||||
chown -R $sintonia_user:$sintonia_user /var/www/sintonia_webapp
|
||||
|
||||
RUN echo "* * * * * cd /var/www/sintonia_webapp && /usr/local/bin/php artisan schedule:run >> /proc/1/fd/1 2>> /proc/1/fd/2" >> /etc/cron.d/laravel_jobs && \
|
||||
chown $sintonia_user:$sintonia_user /etc/cron.d/laravel_jobs && \
|
||||
chmod 0600 /etc/cron.d/laravel_jobs && \
|
||||
crontab -u $sintonia_user /etc/cron.d/laravel_jobs && \
|
||||
chmod u+s /usr/sbin/cron
|
||||
|
||||
USER "$sintonia_user"
|
||||
WORKDIR /home/$sintonia_user
|
||||
# Install composer
|
||||
|
@ -379,6 +386,7 @@ RUN touch /usr/local/var/log/fpm-php.access.log /usr/local/var/log/fpm-php.error
|
|||
sed -i 's/error_log = \/proc\/self\/fd\/2/error_log = \/usr\/local\/var\/log\/fpm-php.error.log/g' /usr/local/etc/php-fpm.d/docker.conf
|
||||
|
||||
COPY ./dev/sintonia-webapp/php/php-ini-development /usr/local/etc/php/php.ini
|
||||
|
||||
USER $sintonia_user
|
||||
|
||||
WORKDIR /var/www/sintonia_webapp
|
||||
|
@ -387,25 +395,28 @@ WORKDIR /var/www/sintonia_webapp
|
|||
#RUN cp $HOME/.env ./
|
||||
ENV sintonia_user=${sintonia_user}
|
||||
### Start server
|
||||
CMD git config --global --add safe.directory /var/www/sintonia_webapp && \
|
||||
/home/$sintonia_user/composer install --no-progress --no-interaction --no-autoloader && \
|
||||
/home/$sintonia_user/composer --no-cache dump-autoload --no-interaction && \
|
||||
php artisan migrate && \
|
||||
php artisan key:generate && \
|
||||
php artisan db:seed RolesAndPermissionsSeeder && \
|
||||
php artisan schedule:run >> /dev/null 2>&1 && \
|
||||
set -eux && \
|
||||
npm i && \
|
||||
php-fpm -D && \
|
||||
npx vite --port $sintonia_vite_port --host & \
|
||||
sleep infinity
|
||||
CMD cron && \
|
||||
git config --global --add safe.directory /var/www/sintonia_webapp && \
|
||||
/home/$sintonia_user/composer install --no-progress --no-interaction --no-autoloader && \
|
||||
/home/$sintonia_user/composer --no-cache dump-autoload --no-interaction && \
|
||||
php artisan migrate && \
|
||||
php artisan key:generate && \
|
||||
php artisan db:seed RolesAndPermissionsSeeder && \
|
||||
php artisan schedule:run >> /dev/null 2>&1 && \
|
||||
set -eux && \
|
||||
npm i && \
|
||||
php-fpm -D && \
|
||||
npx vite --port $sintonia_vite_port --host & \
|
||||
sleep infinity
|
||||
|
||||
|
||||
|
||||
FROM sintonia-webapp-build-common AS sintonia-webapp-production
|
||||
USER $sintonia_user
|
||||
|
||||
COPY ./docker/sintonia-webapp/php/php-ini-production /usr/local/etc/php/php.ini
|
||||
RUN git clone https://git.congegni.net/sintonia_webapp && \
|
||||
RUN cron && \
|
||||
git clone https://git.congegni.net/sintonia_webapp && \
|
||||
cd sintonia_webapp && \
|
||||
php artisan migrate && \
|
||||
php artisan ziggy:generate && \
|
||||
|
@ -414,7 +425,8 @@ RUN git clone https://git.congegni.net/sintonia_webapp && \
|
|||
npx vite build && \
|
||||
cp -r dist/build/* /var/www/html/ && \
|
||||
rm -rf /var/www/sintonia_webapp/node_modules /var/www/sintonia_webapp/.npm /var/www/sintonia_webapp/.composer /var/www/sintonia_webapp/.git && \
|
||||
rm -rf /home/$sintonia_user/node* /home/$sintonia_user/composer
|
||||
rm -rf /home/$sintonia_user/node* /home/$sintonia_user/composer && \
|
||||
php-fpm
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue