-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
81 lines (62 loc) · 3.33 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
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
74
75
76
77
78
79
80
81
ARG FROM=webdevops/php-apache-dev:8.3
FROM $FROM
# Reuse variable
ARG FROM
ENV \
POSTFIX_RELAYHOST="[global-mail]:1025" \
PHP_DISMOD="ioncube" \
PHP_DISPLAY_ERRORS="1" \
PHP_MEMORY_LIMIT="-1" \
DATE_TIMEZONE="Europe/Berlin"
# Bugfix apt cleanup
RUN rm -rf /var/lib/apt/lists/*
# Bufgix Nginx expired certificate ABF5BD827BD9BF62 (This is deprecated)
RUN if [ "${FROM##*:}" = "7.4" ] || [ "${FROM##*:}" = "7.3" ] || [ "${FROM##*:}" = "7.2" ]; then \
curl -s https://nginx.org/keys/nginx_signing.key | apt-key add -; \
fi
RUN \
apt-get update && \
apt-get install -y sudo less vim nano diffutils tree git-core bash-completion zsh htop mariadb-client iputils-ping \
sshpass gettext ncdu exa ripgrep jq python3 python3-venv && \
usermod -aG sudo application && \
echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
update-alternatives --set editor /usr/bin/vim.basic && \
curl -fsSL https://get.docker.com/ | sh && \
mkdir /tmp/docker-files && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN composer self-update --clean-backups
RUN curl -fsSL "https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar" -o /usr/local/bin/wp-cli && \
chmod +x /usr/local/bin/wp-cli
# https://stackoverflow.com/questions/52998331/imagemagick-security-policy-pdf-blocking-conversion#comment110879511_59193253
RUN sed -i '/disable ghostscript format types/,+6d' /etc/ImageMagick-6/policy.xml
COPY .bashrc-additional.sh /tmp/docker-files/
COPY apache/apache.conf /opt/docker/etc/httpd/vhost.common.d/
COPY provision/entrypoint.d/* /opt/docker/provision/entrypoint.d/
#COPY entrypoint.d/* /entrypoint.d/
COPY bin/* /usr/local/bin/
# Configure root
RUN cat /tmp/docker-files/.bashrc-additional.sh >> ~/.bashrc && \
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
# Install python scripts as current user
RUN python3 -m venv ~/.venv && ~/.venv/bin/python3 -m pip install yq
COPY .shell-methods.sh .vimrc .zshrc /root/
COPY .oh-my-zsh/custom/plugins/ssh-agent/ssh-agent.plugin.zsh /root/.oh-my-zsh/custom/plugins/ssh-agent/
COPY .oh-my-zsh/custom/themes/cyb.zsh-theme /root/.oh-my-zsh/custom/themes/
# Configure user
RUN rsync -a /root/.oh-my-zsh/ /home/application/.oh-my-zsh && \
chown -R application:application /home/application/.oh-my-zsh
USER application
RUN cat /tmp/docker-files/.bashrc-additional.sh >> ~/.bashrc
# Install python scripts as current user
RUN python3 -m venv ~/.venv && ~/.venv/bin/python3 -m pip install yq
COPY .shell-methods.sh .vimrc .zshrc /home/application/
COPY .oh-my-zsh/custom/plugins/ssh-agent/ssh-agent.plugin.zsh /home/application/.oh-my-zsh/custom/plugins/ssh-agent/
COPY .oh-my-zsh/custom/themes/cyb.zsh-theme /home/application/.oh-my-zsh/custom/themes/
USER root
# Set user permissions
RUN chown -R application:application /home/application
# set apache user group to application:
RUN if [ -f /etc/apache2/envvars ]; then sed -i 's/export APACHE_RUN_USER=www-data/export APACHE_RUN_USER=application/g' /etc/apache2/envvars; fi
RUN if [ -f /etc/apache2/envvars ]; then sed -i 's/export APACHE_RUN_GROUP=www-data/export APACHE_RUN_GROUP=application/g' /etc/apache2/envvars; fi
# set nginx user group to application:
RUN if [ -f /etc/nginx/nginx.conf ]; then sed -i -E 's/^user\s+(www-data|nginx);/user application application;/g' /etc/nginx/nginx.conf; fi