Skip to content

Commit 2ea6fcc

Browse files
committed
feat: 7.4 apache beta
1 parent 793d66c commit 2ea6fcc

File tree

6 files changed

+2172
-1
lines changed

6 files changed

+2172
-1
lines changed

.bashrc

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# don't put duplicate lines or lines starting with space in the history.
2+
# See bash(1) for more options
3+
HISTCONTROL=ignoreboth
4+
5+
# append to the history file, don't overwrite it
6+
shopt -s histappend
7+
8+
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
9+
HISTSIZE=1000
10+
HISTFILESIZE=2000
11+
12+
# check the window size after each command and, if necessary,
13+
# update the values of LINES and COLUMNS.
14+
shopt -s checkwinsize
15+
16+
# set variable identifying the chroot you work in (used in the prompt below)
17+
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
18+
debian_chroot=$(cat /etc/debian_chroot)
19+
fi
20+
21+
# set a fancy prompt (non-color, unless we know we "want" color)
22+
case "$TERM" in
23+
xterm-color|*-256color) color_prompt=yes;;
24+
esac
25+
26+
if [ -n "$force_color_prompt" ]; then
27+
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
28+
color_prompt=yes
29+
else
30+
color_prompt=
31+
fi
32+
fi
33+
34+
if [ "$color_prompt" = yes ]; then
35+
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
36+
else
37+
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
38+
fi
39+
unset color_prompt force_color_prompt
40+
41+
# If this is an xterm set the title to user@host:dir
42+
case "$TERM" in
43+
xterm*|rxvt*)
44+
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
45+
;;
46+
*)
47+
;;
48+
esac
49+
50+
# enable color support of ls and also add handy aliases
51+
if [ -x /usr/bin/dircolors ]; then
52+
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
53+
alias ls='ls --color=auto'
54+
#alias dir='dir --color=auto'
55+
#alias vdir='vdir --color=auto'
56+
57+
alias grep='grep --color=auto'
58+
alias fgrep='fgrep --color=auto'
59+
alias egrep='egrep --color=auto'
60+
fi
61+
62+
alias ..='cd ..'
63+
alias ...='cd ../../../'
64+
alias ....='cd ../../../../'
65+
alias .....='cd ../../../../'
66+
alias .4='cd ../../../../'
67+
alias .5='cd ../../../../..'
68+
69+
# some more ls aliases
70+
alias ll='ls -alF'
71+
alias la='ls -A'
72+
alias l='ls -CF'

Dockerfile

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
FROM php:7.4-apache
2+
3+
LABEL maintainer="dl@varme.pw"
4+
5+
ENV TZ=Europe/Moscow
6+
7+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
8+
9+
ARG COMPOSER_VERSION="2.1.9"
10+
11+
RUN set -ex && \
12+
apt-get update && apt-get install -y \
13+
libfreetype6-dev \
14+
libjpeg62-turbo-dev \
15+
libpng-dev \
16+
libgmp-dev \
17+
libxml2-dev \
18+
zlib1g-dev \
19+
libncurses5-dev \
20+
libldb-dev \
21+
libldap2-dev \
22+
libicu-dev \
23+
libmemcached-dev \
24+
libcurl4-openssl-dev \
25+
libssl-dev \
26+
libsqlite3-dev \
27+
libzip-dev \
28+
libonig-dev \
29+
curl \
30+
ssmtp \
31+
wget \
32+
git \
33+
nano \
34+
zip \
35+
mariadb-client \
36+
&& rm -rf /var/lib/apt/lists/*
37+
38+
RUN pecl install xdebug-3.1.1 \
39+
&& pecl install memcached-3.1.5 \
40+
&& pecl install redis \
41+
&& docker-php-ext-configure pdo_mysql --with-pdo-mysql=mysqlnd \
42+
&& docker-php-ext-configure mysqli --with-mysqli=mysqlnd \
43+
&& docker-php-ext-configure opcache --enable-opcache \
44+
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
45+
&& docker-php-ext-install -j$(nproc) mysqli pdo_mysql exif pcntl bcmath mbstring gd soap zip opcache sockets
46+
47+
RUN wget https://getcomposer.org/download/${COMPOSER_VERSION}/composer.phar -O /usr/local/bin/composer && \
48+
chmod a+rx /usr/local/bin/composer
49+
50+
RUN groupadd --gid 1000 1000 && \
51+
usermod --non-unique --uid 1000 www-data && \
52+
usermod --gid 1000 www-data
53+
54+
RUN mkdir /var/www/.composer && \
55+
mkdir /var/www/.ssh
56+
57+
RUN chown www-data:www-data /var/www -R && \
58+
chown www-data:www-data /usr/local/etc/php/conf.d -R && \
59+
chown www-data:www-data /var/www/.composer && \
60+
chown www-data:www-data /var/www/.ssh
61+
62+
RUN echo 'DocumentRoot ${DOCUMENT_ROOT}' >> /etc/apache2/apache2.conf && \
63+
echo 'ServerName ${HOST_NAME}' > /etc/apache2/conf-enabled/default.conf && \
64+
echo 'ServerSignature Off' > /etc/apache2/conf-enabled/z-security.conf && \
65+
echo 'ServerTokens Minimal' >> /etc/apache2/conf-enabled/z-security.conf && \
66+
rm /etc/apache2/sites-enabled/000-default.conf
67+
68+
RUN a2enmod rewrite
69+
70+
COPY php.ini /usr/local/etc/php
71+
COPY ssmtp.conf /etc/ssmtp/
72+
COPY .bashrc /var/www/
73+
COPY docker-entrypoint.sh /entrypoint.sh
74+
75+
WORKDIR /var/www
76+
USER www-data:www-data
77+
78+
ENTRYPOINT ["/entrypoint.sh"]

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
# php7.4-apache
1+
# php7.4-apache
2+
3+
### todo
4+
- gid/uid

docker-entrypoint.sh

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [ "$PHP_MODULES" != "" ]; then
5+
for module in $PHP_MODULES; do
6+
docker-php-ext-enable "$module"
7+
done
8+
fi
9+
10+
# Set memcached session save handle
11+
if [ -n "$MEMCACHED" ]; then
12+
if [ -f "$PHP_INI_DIR"/conf.d/20-memcached.ini ]; then
13+
rm "$PHP_INI_DIR"/conf.d/20-memcached.ini
14+
fi
15+
16+
if [ ! -f "$PHP_INI_DIR"/conf.d/docker-php-ext-memcached.ini ]; then docker-php-ext-enable memcached >/dev/null; fi
17+
18+
IFSO=$IFS
19+
IFS=' ' read -ra BACKENDS <<<"${MEMCACHED}"
20+
for BACKEND in "${BACKENDS[@]}"; do
21+
SAVE_PATH="${SAVE_PATH}${BACKEND}?${MEMCACHED_CONFIG:-persistent=1&timeout=5&retry_interval=30},"
22+
done
23+
IFS=$IFSO
24+
25+
cat <<EOF >>"$PHP_INI_DIR"/conf.d/20-memcached.ini
26+
session.save_handler = memcached
27+
session.save_path = "${SAVE_PATH}"
28+
EOF
29+
fi
30+
31+
# Run
32+
if [[ -n "$1" ]]; then
33+
exec "${*}"
34+
else
35+
exec apache2-foreground
36+
fi

0 commit comments

Comments
 (0)