-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile.dev
More file actions
50 lines (38 loc) · 1.12 KB
/
Dockerfile.dev
File metadata and controls
50 lines (38 loc) · 1.12 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
FROM php:7.2-apache
MAINTAINER Troels Madsen <[email protected]>
# Install system dependencies & tools
RUN apt-get update && apt-get install -y \
openssl \
git \
zip \
unzip \
mysql-client
# libapache2-modsecurity \
# && rm -rf /var/lib/apt/lists/*
# Instal php extenstions & enable mod_rewrite
RUN docker-php-ext-install -j$(nproc) \
pdo_mysql \
opcache
RUN a2enmod rewrite
# --> HERE I OMIT THE OWASP modsecurity package. ONLY USED IN PROD! <-- #
WORKDIR /var/www
# Install composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php composer-setup.php && \
php -r "unlink('composer-setup.php');"
EXPOSE 80
ADD . /var/www
# Setup Apache
ADD apache/000-default.conf /etc/apache2/sites-available/000-default.conf
ADD apache/prod.htaccess /var/www/public/.htaccess
# Switch your UID to match the one developing
ARG userid=1000
ARG groupid=1000
RUN usermod -u ${userid} www-data
# RUN groupmod -g ${groupid} www-data
# Don't be root
RUN chown -R www-data:www-data /var/www
USER www-data
# Install dependencies
RUN php composer.phar install --no-interaction
USER root