-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
83 lines (66 loc) · 2.13 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
FROM ubuntu:16.04
MAINTAINER Luca Mattivi <[email protected]>
ENV PROJECT_PATH=/var/www \
PROJECT_URL=images.uala.it \
DEBIAN_FRONTEND=noninteractive \
APACHE_RUN_USER=www-data \
APACHE_RUN_GROUP=www-data \
APACHE_LOG_DIR=/var/log/apache2 \
APACHE_LOCK_DIR=/var/lock/apache2 \
APACHE_PID_FILE=/var/run/apache2/apache2.pid \
PHP_MODS_CONF=/etc/php/7.0/mods-available \
PHP_INI=/etc/php/7.0/apache2/php.ini \
PHP_INI_CONFD=/etc/php/7.0/apache2/conf.d \
TERM=xterm
RUN apt-get update && apt-get upgrade -y --force-yes
# Utilities, Apache, PHP, and supplementary programs
RUN apt-get install -yqq --force-yes \
curl \
git \
wget \
zip \
apache2 \
libapache2-mod-php \
php \
php-curl \
php-dom \
php-mbstring \
php-intl \
php-mcrypt \
php-imagick
# Apache mods
RUN a2enmod rewrite expires headers
# Custom PHP.ini
COPY config/docker/production/php.ini $PHP_INI_CONFD/custom-php.ini
# Apache2 conf
RUN echo "ServerName localhost" | tee /etc/apache2/conf-available/fqdn.conf && \
a2enconf fqdn
# Set the timezone.
RUN echo "Europe/Paris" > /etc/timezone && \
dpkg-reconfigure -f noninteractive tzdata
# Cleanup
RUN apt-get purge -yq \
wget \
patch \
software-properties-common && \
apt-get autoremove -yqq
# Port to expose
EXPOSE 80
# VirtualHost
COPY config/docker/apache-vhost.conf /etc/apache2/sites-available/000-default.conf
# Change workdir
WORKDIR $PROJECT_PATH
# Copy composer json and lock file before the copy o the entire project
COPY composer.json $PROJECT_PATH/composer.json
COPY composer.lock $PROJECT_PATH/composer.lock
# Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN composer install --no-interaction --optimize-autoloader
# Copy site into place
COPY . $PROJECT_PATH
# Folder permissions
RUN chown -R $APACHE_RUN_USER:$APACHE_RUN_GROUP data/
RUN chown -R $APACHE_RUN_USER:root logs/
RUN chown -R $APACHE_RUN_USER:$APACHE_RUN_GROUP public/
# Remove pre-existent apache pid and start apache
CMD rm -f $APACHE_PID_FILE && /usr/sbin/apache2ctl -D FOREGROUND