-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
106 lines (92 loc) · 2.86 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
FROM php:5.6-apache
LABEL maintainer="Maxime Flasquin [email protected]"
# =========================================
# RUN update
# =========================================
RUN apt-get update
# =========================================
# Install dependencies
# =========================================
RUN apt-get install -y libfreetype6-dev \
libicu-dev \
libjpeg62-turbo-dev \
libpng-dev \
libxslt1-dev \
libzip-dev \
sudo \
libmagickwand-dev \
libmagickcore-dev \
apt-transport-https \
libonig-dev
# =========================================
# Install tools
# =========================================
RUN apt-get install -y \
vim \
htop \
openssl
# =========================================
# Configure the GD library
# =========================================
RUN docker-php-ext-configure \
gd --with-freetype --with-jpeg
# =========================================
# Install php required extensions
# =========================================
RUN docker-php-ext-install \
dom \
gd \
intl \
mbstring \
pdo_mysql \
xsl \
zip \
soap \
bcmath \
mysqli \
sockets \
exif
# =========================================
# Install imagick
# =========================================
RUN pecl install -f imagick
# =========================================
# Create mflasquin user
# =========================================
RUN openssl rand -base64 32 > ./.pass \
&& useradd -ms /bin/bash --password='$(cat ./.pass)' mflasquin \
&& echo "$(cat ./.pass)\n$(cat ./.pass)\n" | passwd mflasquin \
&& mv ./.pass /home/mflasquin/ \
&& chown -Rf mflasquin:mflasquin /home/mflasquin
ADD ./bashrc.mflasquin /home/mflasquin/.bashrc
# =========================================
# Create generic SSL certificate
# =========================================
RUN a2enmod rewrite
RUN a2enmod headers
RUN a2enmod ssl
RUN a2ensite default-ssl
RUN cd /etc/ssl/certs && openssl req -subj '/CN=mflasquin.local/O=MFlasquin/C=FR' -new -newkey rsa:2048 -sha256 -days 365 -nodes -x509 -keyout /etc/ssl/private/ssl-cert-snakeoil.key -out /etc/ssl/certs/ssl-cert-snakeoil.pem
# =========================================
# Set ENV variables
# =========================================
ENV APACHE_RUN_USER mflasquin
ENV APACHE_RUN_GROUP mflasquin
ENV PROJECT_ROOT /var/www/html
# =========================================
# PHP Configuration
# =========================================
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
# =========================================
# Expose ports
# =========================================
EXPOSE 80
EXPOSE 443
# =========================================
# Set entrypoint
# =========================================
ADD docker-entrypoint.sh /docker-entrypoint.sh
RUN ["chmod", "+x", "/docker-entrypoint.sh"]
ENTRYPOINT ["/docker-entrypoint.sh"]
WORKDIR $PROJECT_ROOT
CMD ["apache2-foreground"]