forked from outlandishideas/wpackagist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
44 lines (34 loc) · 1.85 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
FROM php:7.4-apache
ARG env
RUN test -n "$env"
# Install the AWS CLI - needed to load in secrets safely from S3. See https://aws.amazon.com/blogs/security/how-to-manage-secrets-for-amazon-ec2-container-service-based-applications-by-using-amazon-s3-and-docker/
RUN apt-get update -qq && apt-get install -y python unzip && \
cd /tmp && \
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" && \
unzip awscli-bundle.zip && \
./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws && \
rm awscli-bundle.zip && rm -rf awscli-bundle && \
rm -rf /var/lib/apt/lists/* /var/cache/apk/*
# Install svn client, a requirement for the current native exec approach; git for
# Composer pulls; libpq-dev for Postgres; libicu-dev for intl; libonig-dev for mbstring.
RUN apt-get update -qq && \
apt-get install -y git libicu-dev libonig-dev libpq-dev subversion && \
rm -rf /var/lib/apt/lists/* /var/cache/apk/*
# intl recommended by something in the Doctrine/Symfony stack for improved performance.
RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
&& docker-php-ext-install intl mbstring pdo_pgsql
# Get latest Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Set up virtual host.
COPY config/apache/symfony.conf /etc/apache2/sites-available/
RUN a2enmod rewrite \
&& a2enmod remoteip \
&& a2dissite 000-default \
&& a2ensite symfony \
&& echo ServerName localhost >> /etc/apache2/apache2.conf
COPY . /var/www/html
# Configure PHP to e.g. not hit 128M memory limit.
COPY ./config/php/php.ini /usr/local/etc/php/
# Ensure Apache can run as www-data and still write to these when the Docker build creates them as root.
RUN chmod -R 777 /var/www/html/var
RUN APP_ENV=${env} composer install --no-interaction --quiet --optimize-autoloader --no-dev