@@ -15,34 +15,36 @@ RUN apt-get update && \
15
15
16
16
RUN a2enmod ssl
17
17
18
- RUN certbot certonly --non-interactive --agree-tos --email webmaster@${DOMAIN} --webroot --webroot-path=/data/letsencrypt -d ${DOMAIN}
18
+ ARG INSTALL_CERTIFICATE
19
19
20
- RUN echo "<VirtualHost *:80>\n \
21
- ServerAdmin webmaster@${DOMAIN}\n \
22
- DocumentRoot /var/www/html\n \
23
- Alias /.well-known/acme-challenge /var/www/letsencrypt/data/.well-known/acme-challenge
24
-
25
- </Directory>\n \
26
- </VirtualHost>" > /etc/apache2/sites-available/000-no-ssl-default.conf
27
-
28
- RUN a2ensite no-ssl-default
29
-
30
- RUN echo "<VirtualHost *:443>\n \
31
- ServerAdmin webmaster@${DOMAIN}\n \
32
- DocumentRoot /var/www/html\n \
33
- SSLEngine on\n \
34
- SSLCertificateFile /etc/letsencrypt/live/${DOMAIN}/fullchain.pem\n \
35
- SSLCertificateKeyFile /etc/letsencrypt/live/${DOMAIN}/privkey.pem\n \
36
- ErrorLog \$ {APACHE_LOG_DIR}/error.log\n \
37
- CustomLog \$ {APACHE_LOG_DIR}/access.log combined\n \
38
- <Directory /var/www/html>\n \
39
- Options Indexes FollowSymLinks\n \
40
- AllowOverride All\n \
41
- Require all granted\n \
42
- </Directory>\n \
43
- </VirtualHost>" > /etc/apache2/sites-available/default-ssl.conf
20
+ RUN if [ "$INSTALL_CERTIFICATE" = "true" ]; then \
21
+ certbot certonly --non-interactive --agree-tos --email webmaster@${DOMAIN} --webroot --webroot-path=/data/letsencrypt -d ${DOMAIN}; \
22
+ fi
44
23
45
- RUN a2ensite default-ssl
24
+ RUN if [ "$INSTALL_CERTIFICATE" = "true" ]; then \
25
+ echo "<VirtualHost *:80>\n \
26
+ ServerAdmin webmaster@${DOMAIN}\n \
27
+ DocumentRoot /var/www/html\n \
28
+ Alias /.well-known/acme-challenge /var/www/letsencrypt/data/.well-known/acme-challenge\n \
29
+ </Directory>\n \
30
+ </VirtualHost>" > /etc/apache2/sites-available/000-no-ssl-default.conf && \
31
+ a2ensite no-ssl-default && \
32
+ echo "<VirtualHost *:443>\n \
33
+ ServerAdmin webmaster@${DOMAIN}\n \
34
+ DocumentRoot /var/www/html\n \
35
+ SSLEngine on\n \
36
+ SSLCertificateFile /etc/letsencrypt/live/${DOMAIN}/fullchain.pem\n \
37
+ SSLCertificateKeyFile /etc/letsencrypt/live/${DOMAIN}/privkey.pem\n \
38
+ ErrorLog \$ {APACHE_LOG_DIR}/error.log\n \
39
+ CustomLog \$ {APACHE_LOG_DIR}/access.log combined\n \
40
+ <Directory /var/www/html>\n \
41
+ Options Indexes FollowSymLinks\n \
42
+ AllowOverride All\n \
43
+ Require all granted\n \
44
+ </Directory>\n \
45
+ </VirtualHost>" > /etc/apache2/sites-available/default-ssl.conf && \
46
+ a2ensite default-ssl; \
47
+ fi
46
48
47
49
COPY . /var/www/html
48
50
@@ -64,4 +66,3 @@ RUN chmod 777 /var/www/html/assets/img
64
66
65
67
ENTRYPOINT ["docker-php-entrypoint" ]
66
68
CMD ["apache2-foreground" ]
67
-
0 commit comments