fix(dockerfile): cron
This commit is contained in:
parent
8a5331f2c5
commit
e5ef7b7004
1 changed files with 27 additions and 15 deletions
20
Dockerfile
20
Dockerfile
|
@ -308,7 +308,8 @@ RUN set -eux && \
|
||||||
libpng-dev \
|
libpng-dev \
|
||||||
git \
|
git \
|
||||||
libonig-dev \
|
libonig-dev \
|
||||||
libpq-dev && \
|
libpq-dev \
|
||||||
|
cron && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
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 /home/$sintonia_user && \
|
||||||
chown -R $sintonia_user:$sintonia_user /var/www/sintonia_webapp
|
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"
|
USER "$sintonia_user"
|
||||||
WORKDIR /home/$sintonia_user
|
WORKDIR /home/$sintonia_user
|
||||||
# Install composer
|
# 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
|
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
|
COPY ./dev/sintonia-webapp/php/php-ini-development /usr/local/etc/php/php.ini
|
||||||
|
|
||||||
USER $sintonia_user
|
USER $sintonia_user
|
||||||
|
|
||||||
WORKDIR /var/www/sintonia_webapp
|
WORKDIR /var/www/sintonia_webapp
|
||||||
|
@ -387,7 +395,8 @@ WORKDIR /var/www/sintonia_webapp
|
||||||
#RUN cp $HOME/.env ./
|
#RUN cp $HOME/.env ./
|
||||||
ENV sintonia_user=${sintonia_user}
|
ENV sintonia_user=${sintonia_user}
|
||||||
### Start server
|
### Start server
|
||||||
CMD git config --global --add safe.directory /var/www/sintonia_webapp && \
|
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 install --no-progress --no-interaction --no-autoloader && \
|
||||||
/home/$sintonia_user/composer --no-cache dump-autoload --no-interaction && \
|
/home/$sintonia_user/composer --no-cache dump-autoload --no-interaction && \
|
||||||
php artisan migrate && \
|
php artisan migrate && \
|
||||||
|
@ -403,9 +412,11 @@ CMD git config --global --add safe.directory /var/www/sintonia_webapp && \
|
||||||
|
|
||||||
|
|
||||||
FROM sintonia-webapp-build-common AS sintonia-webapp-production
|
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
|
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 && \
|
cd sintonia_webapp && \
|
||||||
php artisan migrate && \
|
php artisan migrate && \
|
||||||
php artisan ziggy:generate && \
|
php artisan ziggy:generate && \
|
||||||
|
@ -414,7 +425,8 @@ RUN git clone https://git.congegni.net/sintonia_webapp && \
|
||||||
npx vite build && \
|
npx vite build && \
|
||||||
cp -r dist/build/* /var/www/html/ && \
|
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 /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