fix: deploy
This commit is contained in:
1 parent
77294d26ad
commit
5c234b1ae1
1 file changed
+18
-51
+18
-51
@@ -6,7 +6,7 @@
|
|||||||
RUN if [ "$COMPOSER_NO_DEV" = "1" ]; then \
|
RUN if [ "$COMPOSER_NO_DEV" = "1" ]; then \
|
||||||
composer install --no-dev --prefer-dist --no-progress --no-interaction --classmap-authoritative --no-scripts; \
|
composer install --no-dev --prefer-dist --no-progress --no-interaction --classmap-authoritative --no-scripts; \
|
||||||
else \
|
else \
|
||||||
composer install --prefer-dist --no-progress --no-interaction --no-scripts; \
|
composer install --prefer-dist --no-progress --no-interaction --classmap-authoritative --no-scripts; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# -------- 2) App source --------
|
# -------- 2) App source --------
|
||||||
@@ -40,63 +40,30 @@
|
|||||||
echo "upload_max_filesize=64M"; \
|
echo "upload_max_filesize=64M"; \
|
||||||
echo "post_max_size=64M"; \
|
echo "post_max_size=64M"; \
|
||||||
echo "max_execution_time=60"; \
|
echo "max_execution_time=60"; \
|
||||||
echo "date.timezone=UTC"; \
|
|
||||||
echo "opcache.enable=1"; \
|
|
||||||
echo "opcache.enable_cli=0"; \
|
|
||||||
echo "opcache.validate_timestamps=0"; \
|
|
||||||
echo "opcache.jit=tracing"; \
|
|
||||||
echo "opcache.jit_buffer_size=128M"; \
|
|
||||||
echo "opcache.interned_strings_buffer=16"; \
|
|
||||||
echo "opcache.max_accelerated_files=20000"; \
|
|
||||||
} > /usr/local/etc/php/conf.d/laravel.ini
|
} > /usr/local/etc/php/conf.d/laravel.ini
|
||||||
|
|
||||||
# Dirs
|
# Set timezone
|
||||||
RUN mkdir -p /run/php /run/nginx /var/log/supervisor /var/www/html /etc/nginx/http.d
|
RUN ln -sf /usr/share/zoneinfo/UTC /etc/localtime
|
||||||
|
|
||||||
# Install Composer
|
# Copy application source
|
||||||
RUN set -eux; \
|
WORKDIR /app
|
||||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"; \
|
COPY --from=app_src /app /app
|
||||||
php composer-setup.php --install-dir=/usr/local/bin --filename=composer; \
|
COPY --from=vendor /app/vendor /app/vendor
|
||||||
php -r "unlink('composer-setup.php');"
|
|
||||||
|
|
||||||
# Copy app + vendor
|
# Set permissions for Laravel storage and cache
|
||||||
COPY --from=app_src /app /var/www/html
|
|
||||||
COPY --from=vendor /app/vendor /var/www/html/vendor
|
|
||||||
|
|
||||||
# Nginx, PHP-FPM socket, Supervisor, entrypoint
|
|
||||||
COPY deploy/nginx/default.conf /etc/nginx/http.d/default.conf
|
|
||||||
COPY deploy/php-fpm/zz-socket.conf /usr/local/etc/php-fpm.d/zz-socket.conf
|
|
||||||
COPY deploy/php-fpm/zz-logging.conf /usr/local/etc/php-fpm.d/zz-logging.conf
|
|
||||||
COPY deploy/supervisord.conf /etc/supervisord.conf
|
|
||||||
COPY deploy/entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
||||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
|
||||||
|
|
||||||
WORKDIR /var/www/html
|
|
||||||
|
|
||||||
# Never ship stale compiled caches
|
|
||||||
RUN rm -rf bootstrap/cache/*.php || true
|
|
||||||
|
|
||||||
# Laravel write perms
|
|
||||||
RUN set -eux; \
|
RUN set -eux; \
|
||||||
mkdir -p storage bootstrap/cache; \
|
chown -R www-data:www-data /app/storage /app/bootstrap/cache /app/public; \
|
||||||
chown -R www-data:www-data storage bootstrap/cache; \
|
chmod -R 775 /app/storage /app/bootstrap/cache /app/public
|
||||||
find storage -type d -exec chmod 775 {} \; ; \
|
|
||||||
find storage -type f -exec chmod 664 {} \; ; \
|
|
||||||
chmod -R 775 bootstrap/cache
|
|
||||||
|
|
||||||
# Install Node.js and npm
|
# Configure Nginx
|
||||||
RUN apk add --no-cache nodejs npm
|
RUN mkdir -p /run/nginx
|
||||||
RUN composer run setup
|
COPY ./deploy/nginx/default.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
# Ensure the .env file is not copied into the image
|
# Configure Supervisor
|
||||||
# Add this line to explicitly remove the .env file if it exists
|
COPY ./deploy/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||||
RUN rm -f /var/www/html/.env
|
|
||||||
|
|
||||||
|
# Expose ports
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
HEALTHCHECK --interval=30s --timeout=5s --retries=5 \
|
|
||||||
CMD curl -fsS http://localhost/healthz || exit 10
|
|
||||||
|
|
||||||
# Default: just start services; artisan is opt-in via env
|
|
||||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
|
||||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
|
|
||||||
|
|
||||||
|
# Start Supervisor
|
||||||
|
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
||||||
Reference in new issue
Block a user