This repository was archived by the owner on May 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
73 lines (63 loc) · 2.89 KB
/
Dockerfile
File metadata and controls
73 lines (63 loc) · 2.89 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
FROM debian:stretch
LABEL authors="Michele Federici (@ps1dr3x) <michele@federici.tech>, Giovanni Contino (@micene09) <giovanni.contino09@gmail.com>"
# Args and env vars
ARG HTTP_AUTH_ENABLED
ARG HTTP_AUTH_USER
ARG HTTP_AUTH_PASSWORD
ARG WORDPRESS_VERSION
ARG WORDPRESS_SHA1
ARG XDEBUG_PORT
ARG WPCLI_VERSION
ARG WPCLI_SHA1
ARG PHPUNIT_VERSION
ARG PHPUNIT_SHA1
ENV WORDPRESS_VERSION ${WORDPRESS_VERSION}
ENV WORDPRESS_SHA1 ${WORDPRESS_SHA1}
ENV XDEBUG_PORT ${XDEBUG_PORT}
# Working dir
WORKDIR /var/www/html
# Repository update, installation of needed/common packages, cleanup
RUN apt-get update && \
apt-get -y dist-upgrade && \
apt-get -y install curl net-tools ssl-cert nano vim tmux dos2unix less apache2 apache2-utils libapache2-mod-php php php-mysql php-xdebug php-curl php-mbstring unzip composer mariadb-client && \
apt-get clean && \
rm -rf index.html /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Apache sites conf
COPY configs/000-default.conf /etc/apache2/sites-available/000-default.conf
COPY configs/default-ssl.conf /etc/apache2/sites-available/default-ssl.conf
# Http auth
RUN if [ "${HTTP_AUTH_ENABLED}" = "true" ]; then \
htpasswd -bc /etc/apache2/.htpasswd ${HTTP_AUTH_USER} ${HTTP_AUTH_PASSWORD} && \
echo "=> Http auth enabled"; \
else \
sed -i 's/AuthName/#AuthName/g' /etc/apache2/sites-available/000-default.conf && \
sed -i 's/AuthType/#AuthType/g' /etc/apache2/sites-available/000-default.conf && \
sed -i 's/AuthUserFile/#AuthUserFile/g' /etc/apache2/sites-available/000-default.conf && \
sed -i 's/Require/#Require/g' /etc/apache2/sites-available/000-default.conf && \
sed -i 's/AuthName/#AuthName/g' /etc/apache2/sites-available/default-ssl.conf && \
sed -i 's/AuthType/#AuthType/g' /etc/apache2/sites-available/default-ssl.conf && \
sed -i 's/AuthUserFile/#AuthUserFile/g' /etc/apache2/sites-available/default-ssl.conf && \
sed -i 's/Require/#Require/g' /etc/apache2/sites-available/default-ssl.conf && \
echo "=> Http auth not enabled"; \
fi
# WordPress Configs
RUN mkdir wordpress && \
mkdir tmp
COPY configs/wp-config.php tmp/wp-config.php
# WordPress CLI
RUN curl -L "https://github.com/wp-cli/wp-cli/releases/download/v${WPCLI_VERSION}/wp-cli-${WPCLI_VERSION}.phar" > /usr/bin/wp && \
echo $WPCLI_SHA1 /usr/bin/wp | sha1sum -c - && \
chmod +x /usr/bin/wp
# PHPUnit
RUN curl -L "https://phar.phpunit.de/phpunit-${PHPUNIT_VERSION}.phar" > /usr/bin/phpunit && \
echo $PHPUNIT_SHA1 /usr/bin/phpunit | sha1sum -c - && \
chmod +x /usr/bin/phpunit
# Config/Run scripts
COPY scripts/install.sh install.sh
COPY scripts/configure.sh configure.sh
COPY scripts/run.sh run.sh
# Permissions and line endings conversion (compatibility)
RUN chmod 755 install.sh configure.sh run.sh && \
dos2unix install.sh configure.sh run.sh
# Let's go
CMD ["./run.sh"]