-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
134 lines (113 loc) · 3.25 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
FROM ubuntu:16.04
LABEL maintainer="[email protected]"
# Remove debconf errors
ENV DEBIAN_FRONTEND noninteractive
ENV TERM xterm-256color
# Install defaults
RUN apt-get update && \
apt-get install -y --no-install-recommends --no-install-suggests \
mc \
zip \
curl \
nano \
nginx \
unzip \
gettext \
git-core \
apt-utils \
libssl-dev \
zlib1g-dev \
libpng-dev \
supervisor \
libjpeg-dev \
libwebp-dev \
libxml2-dev \
mysql-client \
libmcrypt-dev \
build-essential \
ca-certificates \
libfreetype6-dev \
libmagickwand-dev \
apt-transport-https \
software-properties-common \
python-software-properties
# Install php7.2
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php -y && \
apt-get update && \
apt-get install -y --no-install-recommends --no-install-suggests \
php7.2-fpm \
php7.2-cli \
php-pear \
php-mcrypt \
php7.2-gd \
php7.2-gmp \
php7.2-zip \
php7.2-xml \
php7.2-cli \
php7.2-pdo \
php7.2-ldap \
php7.2-json \
php7.2-ldap \
php7.2-curl \
php7.2-amqp \
php7.2-intl \
php7.2-soap \
php7.2-iconv \
php7.2-mysql \
php7.2-redis \
php7.2-xmlrpc \
php7.2-mysqli \
php7.2-bcmath \
php7.2-mongodb \
php7.2-sockets \
php7.2-mbstring \
php7.2-fileinfo \
php7.2-simplexml \
php7.2-xdebug
# Install composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php composer-setup.php --install-dir=bin --filename=composer \
&& php -r "unlink('composer-setup.php');"
# Install node
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash && \
apt-get update && apt-get install nodejs
# Install yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install -y --no-install-recommends yarn
# Set timezone - America/Toronto
RUN cp /usr/share/zoneinfo/America/Toronto /etc/localtime
# Forward requests & error logs
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
&& ln -sf /dev/stderr /var/log/php7.2-fpm.log
# Set nginx configuration
COPY ./nginx/default.conf /etc/nginx/sites-enabled/default.conf
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
# Set php configuration
COPY ./php/php.ini /etc/php/7.2/cli/php.ini
COPY ./php/php.ini /etc/php/7.2/fpm/php.ini
# For starting php-fpm with supervisord
RUN sed -i 's/;daemonize = yes/daemonize = no/g' /etc/php/7.2/fpm/php-fpm.conf
# Copy supervisor configuration
COPY ./supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Create directories for php
RUN mkdir -p /var/run/php
RUN mkdir -p /var/log/php-fpm
# Add colors to bash commands
COPY .docker-prompt /etc/.docker-prompt
RUN echo '. /etc/.docker-prompt' >> /etc/bash.bashrc\
&& echo '. /etc/.docker-prompt' >> /root/.bashrc
# Set working directory
WORKDIR /usr/share/nginx/html
# Expose port
EXPOSE 80 3306 2525 6379
# Copy php index file
COPY ./html/index.php /usr/share/nginx/html/index.php
# Create project directory
RUN mkdir -p /usr/share/nginx/html/project
# Set project directory as working directory
WORKDIR /usr/share/nginx/html/project
# Start everything
COPY ./entrypoint.sh /
ENTRYPOINT [ "sh", "/entrypoint.sh" ]