-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.production
78 lines (61 loc) · 2 KB
/
Dockerfile.production
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
FROM php:8.0-fpm
# Set working directory
WORKDIR /var/www
# Install dependencies
RUN apt-get update && apt-get install -y \
build-essential \
locales \
libpng-dev libjpeg62-turbo-dev libfreetype6-dev libxpm-dev \
libonig-dev libpq-dev \
zip libzip-dev \
jpegoptim optipng pngquant gifsicle \
libmemcached-dev \
vim \
unzip \
git \
curl
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install extensions
RUN docker-php-ext-install mbstring exif pcntl
# ZIP
RUN docker-php-ext-install zip
# mysqli
RUN docker-php-ext-install mysqli \
&& docker-php-ext-enable mysqli
# memcached
RUN mkdir -p /usr/src/php/ext/memcached \
&& curl -fsSL https://pecl.php.net/get/memcached | tar xvz -C "/usr/src/php/ext/memcached" --strip 1 \
&& docker-php-ext-install memcached
# redis
RUN mkdir -p /usr/src/php/ext/redis \
&& curl -fsSL https://pecl.php.net/get/redis | tar xvz -C "/usr/src/php/ext/redis" --strip 1 \
&& docker-php-ext-install redis
# Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer \
&& chmod 755 /usr/bin/composer
# GD
RUN docker-php-ext-configure gd \
--with-freetype=/usr/include/ \
--with-jpeg=/usr/include/ \
--with-xpm=/usr/include/ \
&& NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) \
&& docker-php-ext-install -j${NPROC} gd
ADD .docker/php/docker-php-enable-jit.production.ini /usr/local/etc/php/conf.d/docker-php-enable-jit.ini
ADD .docker/php/docker-php-ext-redis.ini /usr/local/etc/php/conf.d/docker-php-ext-redis.ini
# Add user for application
RUN groupadd -g 1000 www
RUN useradd -u 1000 -ms /bin/bash -g www www
# Copy existing application directory contents
COPY . /var/www
# Copy existing application directory permissions
COPY --chown=www:www . /var/www
# Install dependencies
RUN cd /var/www \
&& rm -rf vendor/ composer.lock \
&& composer install
# Change current user to www
USER www
# Expose port 9000 and start php-fpm server
EXPOSE 9000
CMD ["php-fpm"]