-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
58 lines (43 loc) · 1.36 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
FROM php:8.2.13-fpm
# Arguments defined in docker-compose.yml
ARG user
ARG uid
# Copy composer.json to /var/www/
COPY composer.json /var/www/
# Set working directory
WORKDIR /var/www
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
zip \
unzip
# 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
# Get latest Composer
COPY --from=composer:2.7.2 /usr/bin/composer /usr/bin/composer
# We install composer dependencies
RUN composer install --no-ansi --no-interaction --no-progress --optimize-autoloader --no-scripts
# We copy all the files from the current folder of
# laravel files to /var/www/
COPY . .
# To generate the necessary files that Composer will use for autoloading
RUN composer dump-autoload -o
# Create system user to run Composer and Artisan Commands
RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer && \
chown -R $user:$user /home/$user
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd
USER $user
EXPOSE 9000
CMD ["php-fpm"]