-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (49 loc) · 1.57 KB
/
Dockerfile
File metadata and controls
58 lines (49 loc) · 1.57 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
FROM webdevops/php-apache-dev:7.4
# Environment variables
ENV APPLICATION_PATH=/var/www/html \
WEB_DOCUMENT_ROOT=/var/www/html/web \
PHP_DEBUGGER=xdebug \
PHP_MEMORY_LIMIT=1024M \
PHP_DATE_TIMEZONE=Europe/Rome \
PHP_DISPLAY_ERRORS=1 \
XDEBUG_DISCOVER_CLIENT_HOST=0 \
XDEBUG_MODE=debug \
XDEBUG_START_WITH_REQUEST=1 \
XDEBUG_CLIENT_HOST=host.docker.internal \
XDEBUG_CLIENT_PORT=9000
# Commont tools
RUN apt-get update && apt-get dist-upgrade -y && apt-get install -y \
sudo \
gettext \
libfreetype6-dev \
libpng-dev \
default-mysql-client \
nano
# Reconfigure GD
RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg; \
docker-php-ext-install -j "$(nproc)" gd
# Add application user to sudoers
RUN usermod -aG sudo ${APPLICATION_USER} \
&& echo "${APPLICATION_USER} ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers.d/${APPLICATION_USER}
# Finalize installation and clean up
RUN docker-run-bootstrap \
&& docker-image-cleanup \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Change user
USER ${APPLICATION_USER}
# Add bash aliases and terminal conf
RUN { \
echo ' '; \
echo '# Add bash aliases.'; \
echo 'if [ -f $APPLICATION_PATH/.aliases ]; then' | envsubst; \
echo ' source $APPLICATION_PATH/.aliases' | envsubst; \
echo 'fi'; \
echo ' '; \
echo '# Add terminal config.'; \
echo 'stty rows 80; stty columns 160;'; \
} >> ~/.bashrc
# Container must start as root user
USER root
# Default work dir
WORKDIR ${APPLICATION_PATH}