This repository has been archived by the owner on Apr 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
78 lines (62 loc) · 1.9 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
FROM composer:1.9 as intermediate
ENV COMPOSER_CACHE_DIR=/tmp/.composer
# Copy composer files
COPY composer.json /var/www/app/composer.json
COPY composer.lock /var/www/app/composer.lock
# Make the app the pwd
WORKDIR /var/www/app
RUN composer install --ignore-platform-reqs --no-interaction --no-scripts --no-autoloader
ENV DEBIAN_FRONTEND=noninteractive \
NGINX_VERSION=1.14.0-1~stretch \
SERVER_NAME=_
FROM php:7.3-fpm
RUN apt-get -y update
RUN apt-get install -y -qq \
curl \
cron \
gettext \
git \
gnupg \
libcurl3-dev \
libmcrypt-dev \
libpng-dev \
libssl-dev \
libxml2-dev \
libzip-dev \
supervisor \
wget \
vim \
libonig-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# install system dependencies
RUN docker-php-ext-install -j$(nproc) \
bcmath \
curl \
gd \
json \
mbstring \
opcache \
pdo_mysql \
xml \
zip
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 \
&& echo "deb http://nginx.org/packages/debian/ stretch nginx" >> /etc/apt/sources.list \
&& apt-get update
RUN apt-get install --no-install-recommends --no-install-suggests -q -y \
nginx=1.14.0-1~stretch
# Whitelist ALLOWED_HOSTS and APP_ENV in fpm config
RUN { \
echo 'env[ALLOWED_HOSTS] = $ALLOWED_HOSTS'; \
echo 'env[APP_ENV] = $APP_ENV'; \
} >> /usr/local/etc/php-fpm.d/www.conf && \
sed -i "s/\# server_tokens off\;/server_tokens off\;/" /etc/nginx/nginx.conf
RUN wget https://getcomposer.org/download/1.9.3/composer.phar && \
mv composer.phar /usr/local/bin/composer && \
chmod a+x /usr/local/bin/composer
COPY --from=intermediate --chown=www-data:www-data /var/www/app/vendor /var/www/app/vendor
# Use unprivileged user
WORKDIR /var/www/app
# Add code
COPY --chown=www-data:www-data . /var/www/app
RUN composer dump-autoload --optimize