-
Notifications
You must be signed in to change notification settings - Fork 0
/
bak.Dockerfile
152 lines (129 loc) · 4.36 KB
/
bak.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#FROM node:20.0.0-alpine as node
FROM node:19.9.0-alpine AS node
#FROM php:8.1.22-fpm-alpine3.16 AS base
FROM php:8.1.28-fpm-alpine3.18 AS base
# Setup Working Dir
WORKDIR /var/www
# Musl for adding locales
ENV MUSL_LOCALE_DEPS="cmake make musl-dev gcc gettext-dev libintl"
ENV MUSL_LOCPATH="/usr/share/i18n/locales/musl"
RUN apk add --no-cache \
$MUSL_LOCALE_DEPS \
&& wget https://gitlab.com/rilian-la-te/musl-locales/-/archive/master/musl-locales-master.zip \
&& unzip musl-locales-master.zip \
&& cd musl-locales-master \
&& cmake -DLOCALE_PROFILE=OFF -D CMAKE_INSTALL_PREFIX:PATH=/usr . && make && make install \
&& cd .. && rm -r musl-locales-master
# Add Repositories
RUN rm -f /etc/apk/repositories &&\
echo "http://dl-cdn.alpinelinux.org/alpine/v3.18/main" >> /etc/apk/repositories && \
echo "http://dl-cdn.alpinelinux.org/alpine/v3.18/community" >> /etc/apk/repositories
# Add Build Dependencies
RUN apk update && apk add --no-cache --virtual .build-deps \
zlib-dev \
libjpeg-turbo-dev \
libpng-dev \
python3 \
gcc \
clang \
llvm \
libxml2-dev \
bzip2-dev
# Add Production Dependencies
RUN apk add --update --no-cache \
bash \
jq \
nano \
git \
openssh \
pcre-dev ${PHPIZE_DEPS} \
jpegoptim \
pngquant \
optipng \
supervisor \
nginx \
dcron \
libcap \
icu-dev \
freetype-dev \
postgresql-dev \
postgresql-client \
zip \
libzip-dev \
less \
imagemagick \
libxslt-dev \
exiftool \
imagemagick-dev \
chromium \
&& pecl install redis \
&& pecl install -o -f imagick
# Configure & Install Extension
RUN docker-php-ext-configure \
opcache --enable-opcache &&\
docker-php-ext-configure gd --with-jpeg=/usr/include/ --with-freetype=/usr/include/ && \
docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql &&\
docker-php-ext-configure zip && \
docker-php-ext-install \
opcache \
mysqli \
pgsql \
pdo \
pdo_mysql \
pdo_pgsql \
sockets \
intl \
gd \
xml \
bz2 \
pcntl \
bcmath \
exif \
zip \
xsl \
&& docker-php-ext-enable \
imagick \
redis && \
chown www-data:www-data /usr/sbin/crond && \
setcap cap_setgid=ep /usr/sbin/crond
COPY ./config/php.ini $PHP_INI_DIR/conf.d/
# Setup config for supervisor nginx php-fpm crontabs
RUN mkdir /etc/supervisor.d
COPY ./config/supervisord-master.ini /etc/supervisor.d/master.ini
COPY ./config/supervisord.conf /etc/
RUN mkdir /var/log/supervisor/
RUN touch /var/log/supervisor/supervisord.log
RUN chown -R www-data:www-data /var/log/supervisor/
COPY ./config/nginx-default.conf /etc/nginx/conf.d/default.conf
COPY ./config/nginx.conf /etc/nginx/nginx.conf
# Tests
#RUN chmod -R 777 /etc/nginx/
#RUN chown www-data:www-data /etc/nginx/conf.d/default.conf
#RUN chown www-data:www-data /etc/nginx/nginx.conf
COPY ./config/php-fpm.conf /usr/local/etc/php-fpm.conf.d/www.conf
COPY ./config/php-fpm.conf /usr/local/etc/php-fpm.d/www.conf
COPY ./config/php-fpm-docker.conf /usr/local/etc/php-fpm.d/docker.conf
RUN chmod 755 -R /etc/supervisor.d/ /etc/supervisord.conf /etc/nginx/ /etc/crontabs/
# Remove Build Dependencies
RUN apk del -f .build-deps
RUN mkdir -p /var/lib/nginx/tmp /var/log/nginx \
&& chown -R www-data:www-data /var/lib/nginx /var/log/nginx /etc/nginx \
&& chmod -R 755 /var/lib/nginx /var/log/nginx /etc/nginx
# Add non root user to the tty group, so we can write to stdout and stderr
RUN addgroup www-data tty
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Install Node
COPY --from=node /usr/lib /usr/lib
COPY --from=node /usr/local/share /usr/local/share
COPY --from=node /usr/local/lib /usr/local/lib
COPY --from=node /usr/local/include /usr/local/include
COPY --from=node /usr/local/bin /usr/local/bin
# Puppeteer npm configuration.
# It uses apk installed Chromium "/usr/bin/chromium-browser", tell Puppeteer to not install local Chromium which takes time.
# Compatible version = Puppeteer 10.0.0. Install in project with "npm install [email protected]".
# More info here : https://stackoverflow.com/questions/69417926/docker-error-eacces-permission-denied-mkdir
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
USER www-data
#CMD ["/usr/bin/supervisord"]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]