forked from HKFree/UserDB
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
78 lines (58 loc) · 2.98 KB
/
Copy pathDockerfile
File metadata and controls
78 lines (58 loc) · 2.98 KB
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
####################################################################################################
# 1st stage (composer deps only, in order to populate cache and speed up builds)
FROM php:7.2-apache-stretch AS userdb-runtime
RUN a2enmod rewrite
RUN a2enmod headers
# Debian 9 "stretch" je uz starej -> lze stahovat pouze z archivu
RUN echo '\n\
deb http://archive.debian.org/debian stretch main contrib non-free\n\
deb-src http://archive.debian.org/debian stretch main contrib non-free\n\
deb http://archive.debian.org/debian-security/ stretch/updates main contrib non-free\n\
deb-src http://archive.debian.org/debian-security/ stretch/updates main contrib non-free' > /etc/apt/sources.list
# Install extenstions: MySQL PDO, GD
RUN apt-get update && apt-get install -y \
git \
zip \
unzip \
libpq-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
python \
&& docker-php-ext-configure pdo_mysql --with-pdo-mysql=mysqlnd \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install pdo pdo_mysql gd zip
# Enable and configure xdebug
#RUN pecl install xdebug
#RUN docker-php-ext-enable xdebug
#RUN echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
##RUN echo "xdebug.remote_connect_back=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
#RUN echo "xdebug.remote_host=172.17.0.1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
# Use the default production configuration
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
RUN echo "max_input_vars = 3000" >> /usr/local/etc/php/conf.d/uploads.ini
RUN echo "log_errors = On" >> /usr/local/etc/php/conf.d/log.ini
RUN echo "error_log = /dev/stderr" >> /usr/local/etc/php/conf.d/log.ini
RUN echo "zend.multibyte = On" >> /usr/local/etc/php/conf.d/mb.ini
RUN echo "date.timezone = Europe/Prague" > /usr/local/etc/php/conf.d/timezone.ini
COPY apache.conf /etc/apache2/sites-enabled/000-default.conf
RUN echo "<?php header('Location: /userdb/');" > /var/www/html/index.php
RUN mkdir -p /opt/userdb
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
WORKDIR /opt/userdb
RUN mkdir vendor
# intentional caching of the composer-deps layer
COPY composer.json composer.lock /opt/userdb/
RUN composer install
####################################################################################################
# 2nd stage (in order to support composer deps caching)
FROM userdb-runtime
# create empty config.local.neon, we use env. variables for production configuration
RUN mkdir -p /opt/userdb/app/config
RUN echo "" > /opt/userdb/app/config/config.local.neon
# copy application (bind volume to the path during development in order to override the baked-in app version)
COPY . /opt/userdb
# make some dirs writable by apache httpd
RUN chmod 777 -R /opt/userdb/log
RUN chmod 777 -R /opt/userdb/temp
RUN chmod 777 -R /opt/userdb/vendor/mpdf/mpdf/tmp