-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
76 lines (61 loc) · 2.26 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
FROM ubuntu:xenial
# Set UTC
RUN apt-get update \
&& apt-get install -y locales \
&& locale-gen en_US.UTF-8 \
# software-properties-common & python-software-properties to install apt-add-repository
&& apt-get install -y software-properties-common python-software-properties \
&& apt-get update \
# Add PHP repository
&& LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php \
&& add-apt-repository ppa:jonathonf/backports \
&& apt-get update \
# Install LAMP stack
&& apt-get install -y \
apache2 \
git \
libapache2-mod-php7.3 \
lynx-cur \
php7.3 \
php7.3-gd \
php7.3-mysql \
php7.3-xml \
php-cli \
php-curl \
php-mbstring \
vim \
wget \
curl \
# Clean image and repo list
&& apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/* \
# Enable apache mods
&& a2enmod headers \
&& a2enmod php7.3 \
&& a2enmod rewrite \
# Set servername
&& echo ServerName localhost >> /etc/apache2/apache2.conf
# Set environment variables
ENV APACHE_RUN_USER=www-data \
APACHE_RUN_GROUP=www-data \
APACHE_LOG_DIR=/var/log/apache2 \
APACHE_PID_FILE=/var/run/apache2.pid \
APACHE_RUN_DIR=/var/run/apache2 \
APACHE_LOCK_DIR=/var/lock/apache2
# Create directories
RUN mkdir -p $APACHE_RUN_DIR $APACHE_LOCK_DIR $APACHE_LOG_DIR \
# Chown directories owned by apache
&& chown -hR www-data:www-data /var/www/ \
# Download composer
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
&& php composer-setup.php --install-dir=/usr/local/bin/ --filename=composer \
&& php -r "unlink('composer-setup.php');" \
&& echo "alias composer=/usr/local/bin/composer" >> ~/.bashrc
# Set /var/www/ as working directory
WORKDIR /var/www/
# Expose port 80
EXPOSE 80
# Update the default apache site with the apache.conf file within our directory
ADD apache.conf /etc/apache2/sites-enabled/000-default.conf
# By default start up apache in the foreground, override with /bin/bash for interative.
CMD ["apache2", "-D", "FOREGROUND"]