This commit is contained in:
parent
9fd692bcfd
commit
5b4d56d003
23
Dockerfile
23
Dockerfile
@ -1,4 +1,4 @@
|
|||||||
FROM php:8.3-fpm
|
FROM php:8.3-cli
|
||||||
|
|
||||||
# Install system dependencies & PHP extensions
|
# Install system dependencies & PHP extensions
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
@ -21,29 +21,30 @@ COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
|||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /var/www
|
WORKDIR /var/www
|
||||||
|
|
||||||
# Copy source
|
# Copy source code
|
||||||
COPY . .
|
COPY . .
|
||||||
COPY .env.example .env
|
COPY .env.example .env
|
||||||
|
|
||||||
# Set permission
|
# Set permissions for Laravel writable directories
|
||||||
RUN chown -R www-data:www-data /var/www
|
RUN mkdir -p storage bootstrap/cache \
|
||||||
|
&& chown -R www-data:www-data /var/www \
|
||||||
|
&& chmod -R ug+rwx storage bootstrap/cache
|
||||||
|
|
||||||
|
# Use non-root user for installing dependencies
|
||||||
USER www-data
|
USER www-data
|
||||||
|
|
||||||
# Install dependencies & generate app key
|
# Install PHP dependencies
|
||||||
RUN composer install --no-interaction --prefer-dist --optimize-autoloader
|
RUN composer install --no-interaction --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
# Uncomment if you want to generate key automatically (optional)
|
# Back to root to ensure runtime permissions
|
||||||
# RUN php artisan key:generate
|
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
# Set storage & cache permission
|
# Re-apply permissions to writable folders
|
||||||
RUN chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache \
|
RUN chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache \
|
||||||
&& chmod -R 775 /var/www/storage /var/www/bootstrap/cache
|
&& chmod -R 775 /var/www/storage /var/www/bootstrap/cache
|
||||||
|
|
||||||
# Expose default Laravel serve port
|
# Expose Laravel development server port
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
# Use artisan serve instead of php-fpm
|
# Run with artisan serve instead of php-fpm
|
||||||
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]
|
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user