-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.template
75 lines (60 loc) · 2.33 KB
/
Dockerfile.template
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
FROM ubuntu:22.04
MAINTAINER Tin Benjamin Matuka <[email protected]>
# set up timezone
ENV TIMEZONE="UTC"
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# install deps, apache, php and php modules all in one run and clean up afterwards to reduce the snapshot size
RUN apt-get clean && \
apt-get -y update && \
apt-get install -y --force-yes \
locales \
curl \
software-properties-common \
git \
apt-transport-https \
sudo \
nvi \
iproute2 \
telnet \
dnsutils \
unzip \
rsync \
inetutils-ping && \
locale-gen en_US.UTF-8 && \
LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php && apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes \
imagemagick \
##php-packages## \
php-mail && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# set php version as active
RUN update-alternatives --set php "/usr/bin/php##php-version##"
# add www-data to sudoers
COPY ./sudoers /etc/sudoers.d/www-data
# prepare www-data to be used as main user
RUN usermod -s /bin/bash -G staff www-data && \
mkdir -p /var/www /app && \
touch /var/www/.bash_profile && \
chown -R www-data. /var/www /app
# install composer
RUN curl https://getcomposer.org/composer-1.phar > composer1 && \
curl https://getcomposer.org/composer-2.phar > composer && \
mv composer1 composer /usr/local/bin/ && \
chown www-data:www-data /usr/local/bin/composer1 /usr/local/bin/composer && \
chmod +x /usr/local/bin/composer1 /usr/local/bin/composer
# install yarn without nodejs
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && \
apt-get -y update && \
apt-get install -y --no-install-recommends yarn && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# install nvm
RUN sudo -i -u www-data sh -c 'curl -sL -o- "https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh" | bash'
# this lets us make our build behave differently if needed
ENV DOCKER="yes"
# prepare entrypoint and default command
COPY ./entrypoint.sh /usr/local/bin/
WORKDIR /app/
USER www-data
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD []