-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
68 lines (58 loc) · 2.08 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
ARG PHP_VERSION=8.2
# Set a BASE_IMAGE CI var to specify a different base image
ARG BASE_IMAGE=ghcr.io/10up/wp-php-fpm
ARG UBUNTU_RELEASE_NAME=jammy
FROM ${BASE_IMAGE}:${PHP_VERSION}-${UBUNTU_RELEASE_NAME}
ARG PHP_VERSION=8.2
USER root
RUN \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y \
php${PHP_VERSION}-xdebug \
mariadb-client \
netcat-traditional \
wget \
curl \
git \
strace \
telnet \
rsync \
vim \
sudo \
iproute2 \
subversion \
unzip && apt clean all && rm -rf /var/lib/apt/lists/*
WORKDIR /
COPY scripts/composer-installer.sh /composer-installer.sh
COPY scripts/composer /usr/local/bin/composer
RUN \
sh /composer-installer.sh && \
chmod +x /usr/local/bin/composer
RUN curl https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -o /usr/local/bin/wp
RUN chmod +x /usr/local/bin/wp
RUN echo "ALL ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/enable-all
# entrypoint needs to manage the PHP config but will be running as www-data
# Get things setup and then re-own the files necessary to allow this
#RUN mkdir /etc/php-extensions-available; \
# mv /etc/php/${PHP_VERSION}/mods-available/xdebug.ini /etc/php-extensions-available; \
# chown www-data -R /etc/php*
COPY entrypoint-dev.sh /
COPY bash.sh /
RUN chmod +x /entrypoint-dev.sh && \
chmod +x /bash.sh
RUN echo "opcache.validate_timestamps=1" >> /etc/php/${PHP_VERSION}/mods-available/docker-opcache.ini
RUN cp -a /etc/skel /home/www-data && chown 33:33 -R /home/www-data && usermod -d /home/www-data www-data
USER www-data
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash && \
source ~/.profile && \
nvm install --lts && \
composer global require 10up/wpsnapshots && \
echo "export PATH=$(composer global config bin-dir --absolute -q):$PATH" >> ~/.bashrc
RUN \
curl -o /tmp/snapshots.zip https://codeload.github.com/10up/snapshots/zip/refs/tags/1.2.1 && \
wp package install /tmp/snapshots.zip && \
rm -f /tmp/snapshots.zip
WORKDIR /var/www/html
ENTRYPOINT []
CMD ["/entrypoint-dev.sh"]