-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
48 lines (36 loc) · 1.36 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
ARG VERSION="8.3"
FROM php:${VERSION}-apache
# Set the working directory in the container
WORKDIR /var/www/html
# Copy the code into the container
COPY . .
## Set default php.ini
RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini
## Copy custom configurations
COPY ./deployment/apache.conf /etc/apache2/sites-available/000-default.conf
COPY ./deployment/php.ini /usr/local/etc/php/conf.d/custom-php.ini
# Install PHP extensions and other dependencies
RUN apt-get update && \
apt-get install -y wget git libpq-dev libicu-dev && \
docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql && \
docker-php-ext-install intl opcache pgsql pdo pdo_pgsql && \
pecl install mongodb && \
docker-php-ext-enable mongodb && \
rm -rf /var/lib/apt/lists/* && \
a2enmod rewrite
## Install composer
RUN wget https://getcomposer.org/installer && \
php installer --install-dir=/usr/local/bin/ --filename=composer && \
rm installer
## Setting env
ENV APP_ENV=prod
ENV COMPOSER_ALLOW_SUPERUSER=1
## Install application dependencies
RUN composer install --no-dev --no-interaction --optimize-autoloader
## Change files owner to apache default user
RUN chown -R www-data:www-data /var/www/html
## Cleanup
RUN composer dump-autoload --no-dev --classmap-authoritative && \
rm /usr/local/bin/composer
# Expose the port Apache listens on
EXPOSE 80