-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
58 lines (45 loc) · 1.23 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
53
54
55
56
57
58
# Base image
FROM php:8.3-fpm
# Arguments defined in docker-compose.yml
ARG user
ARG uid
# Install dependencies
RUN apt-get update && apt-get install -y \
nginx \
libpq-dev \
libzip-dev \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
zip \
unzip \
&& docker-php-ext-install pdo_mysql intl zip \
&& docker-php-ext-install mbstring \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug
## Install MySQL client
RUN apt-get install -y default-mysql-client
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
#RUN useradd -G www-data,root -u $uid -d /home/$user $user
#RUN mkdir -p /home/$user/.composer && \
# chown -R $user:$user /home/$user
# Set working directory
WORKDIR /var/www
# Copy Laravel project files
COPY . /var/www/
# Install Laravel dependencies
RUN composer install --no-interaction --no-dev --prefer-dist
# Set permissions
RUN chown -R www-data:www-data /var/www/* \
&& chmod -R 755 /var/www/storage
# Configure Nginx
COPY nginx.conf /etc/nginx/sites-available/default
# Expose ports
EXPOSE 80
# Start Nginx and PHP-FPM
CMD service nginx start && php-fpm
# Set up the user
#USER ${user}