forked from nguyenanhung/codeigniter3-vercel-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
102 lines (80 loc) · 2.51 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
FROM php:7.4-fpm
# Copy composer.lock and composer.json
# COPY composer.lock composer.json /var/www/
# Set working directory
WORKDIR /var/www
# Set ENV
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="0" \
PHP_OPCACHE_MAX_ACCELERATED_FILES="50000" \
PHP_OPCACHE_MEMORY_CONSUMPTION="256" \
PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10"
# Install dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libpng-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
libpq-dev \
g++ \
libicu-dev \
libxml2-dev \
libzip-dev \
libonig-dev \
locales \
zip \
jpegoptim optipng pngquant gifsicle \
vim \
unzip \
git \
curl \
autoconf \
pkg-config \
libssl-dev
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install extensions
RUN docker-php-ext-install mysqli pdo_mysql mbstring zip exif bcmath soap
RUN docker-php-ext-configure intl
RUN docker-php-ext-install intl
# Install OpCache
RUN docker-php-ext-install opcache
COPY ./docker/php/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
COPY ./docker/php/opcache-default.blacklist /usr/local/etc/php/conf.d/opcache-default.blacklist
# Install GD
RUN docker-php-ext-configure gd --with-jpeg=/usr/include/ --with-freetype=/usr/include/
#RUN docker-php-ext-configure gd --with-gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ --with-png=/usr/include/
RUN docker-php-ext-install gd
# Install mcrypt
RUN apt-get update && apt-get install -y \
libmcrypt-dev
RUN pecl install mcrypt \
&& docker-php-ext-enable mcrypt
# Install apcu
RUN pecl install apcu \
&& docker-php-ext-enable apcu
# Install Imagemagick & PHP Imagick ext
RUN apt-get update && apt-get install -y \
libmagickwand-dev --no-install-recommends
RUN pecl install imagick && docker-php-ext-enable imagick
# Install xdebug
RUN pecl install xdebug && docker-php-ext-enable xdebug
# remove not necessary files
RUN rm -rf /var/lib/apt/lists/*
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Add user for laravel 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
# Permission
RUN chown www:www /var/www
RUN chown www:www /tmp
# Change current user to www
# Change current user to www
USER www
# Expose port 9000 and start php-fpm server
EXPOSE 9000
CMD ["php-fpm"]