-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (42 loc) · 1.26 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Use the official PHP image as the base image
FROM php:8.3-fpm
# Set working directory
WORKDIR /var/www
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
locales \
zip \
jpegoptim optipng pngquant gifsicle \
vim \
unzip \
git \
curl \
libonig-dev
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Copy existing application directory contents
COPY . /var/www
# Set permissions for storage and bootstrap/cache
# Don't ask me why I'm doing this
RUN chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache && \
chmod -R 777 /var/www/storage /var/www/bootstrap/cache && \
chmod -R 777 /var/www/storage/logs && \
chmod -R 777 /var/www/storage/framework/views
# Change current user to www-data
USER www-data
# Clear Laravel caches and views
RUN php artisan view:clear && \
php artisan cache:clear && \
php artisan config:clear && \
php artisan route:clear
# Expose port 9000 and start php-fpm server
EXPOSE 9000
CMD ["php-fpm"]