forked from Baqend/webpagetest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-php
141 lines (126 loc) · 4.87 KB
/
Dockerfile-php
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
FROM alpine:3.13 as build
ARG FFMPEG_VERSION=4.3.2
ARG PREFIX=/opt/ffmpeg
ARG LD_LIBRARY_PATH=/opt/ffmpeg/lib
ARG MAKEFLAGS="-j4"
RUN apk add --no-cache --update \
build-base \
coreutils \
freetype-dev \
gcc \
lame-dev \
libgomp \
libogg-dev \
libass \
libass-dev \
libvpx-dev \
libvorbis-dev \
libwebp-dev \
libtheora-dev \
opus-dev \
openssl \
openssl-dev \
pkgconf \
pkgconfig \
rtmpdump-dev \
wget \
x264-dev \
x265-dev \
yasm
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories \
&& echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories \
&& apk add --no-cache --update fdk-aac-dev rav1e-dev
WORKDIR /tmp/
RUN wget --progress=dot:giga http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz \
&& tar zxf ffmpeg-${FFMPEG_VERSION}.tar.gz && rm ffmpeg-${FFMPEG_VERSION}.tar.gz
# Compile ffmpeg.
WORKDIR /tmp/ffmpeg-${FFMPEG_VERSION}
RUN ./configure \
--enable-version3 \
--enable-gpl \
--enable-nonfree \
--enable-small \
--enable-libmp3lame \
--enable-libx264 \
--enable-libx265 \
--enable-libvpx \
--enable-libtheora \
--enable-libvorbis \
--enable-libopus \
--enable-libfdk-aac \
--enable-libass \
--enable-libwebp \
--enable-librtmp \
--enable-librav1e \
--enable-postproc \
--enable-avresample \
--enable-libfreetype \
--enable-filter=scale \
--enable-filter=decimate \
--enable-openssl \
--disable-debug \
--disable-doc \
--disable-ffplay \
--extra-cflags="-I${PREFIX}/include" \
--extra-ldflags="-L${PREFIX}/lib" \
--extra-libs="-lpthread -lm" \
--prefix="${PREFIX}" \
&& make \
&& make install \
&& make distclean
# Cleanup.
RUN rm -rf /var/cache/apk/* /tmp/*
FROM php:7.4-fpm-alpine
LABEL maintainer="Wolfgang Schiffels<wolfgang.schiffels@baqend.com>"
ENV PATH=/opt/ffmpeg/bin:$PATH
ENV PYTHONUNBUFFERED=1
RUN apk add --no-cache supervisor beanstalkd zip libzip python2 libtheora rtmpdump x264-dev x265-dev \
libpng libjpeg imagemagick imagemagick-libs imagemagick-dev libass librtmp libvpx libwebp lame pcre \
libogg libvorbis exiftool libjpeg-turbo-utils freetype zlib x264-libs x265 libzip opus bash libgomp \
&& apk add --no-cache --virtual .build-deps zlib-dev libpng-dev jpeg-dev freetype-dev \
libzip-dev curl-dev autoconf gcc libc-dev make \
&& python -m ensurepip \
&& pip2 install ffmpeg \
&& mkdir -p /var/www/ \
&& mkdir -p /scripts \
&& docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ \
&& docker-php-ext-install gd \
&& docker-php-ext-configure zip \
&& docker-php-ext-install zip \
&& docker-php-ext-install curl \
&& printf "\n" | pecl install imagick \
&& printf "\n" | pecl install apcu \
&& docker-php-ext-enable imagick \
&& apk del --no-cache .build-deps \
&& rm -rf /var/cache/apk/*
COPY --from=build /opt/ffmpeg /opt/ffmpeg
COPY --from=build /usr/lib/libfdk-aac.so.2 /usr/lib/libfdk-aac.so.2
COPY --from=build /usr/lib/librav1e.so /usr/lib/librav1e.so
COPY --from=build /usr/lib/libx264.so.157 /usr/lib/libx264.so.157
COPY docker/server/config/fpm-pool.conf /etc/php7/php-fpm.d/www.conf
COPY docker/server/config/php.ini /usr/local/etc/php/
COPY docker/server/config/crontab /etc/crontab
COPY docker/server/config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY docker/server/config/supervisord/supervisord_php-fpm.conf /etc/supervisor/conf.d/supervisord_php-fpm.conf
COPY docker/server/config/supervisord/supervisord_beanstalkd.conf /etc/supervisor/conf.d/supervisord_beanstalkd.conf
COPY docker/server/config/supervisord/supervisord_ec2init.conf /etc/supervisor/conf.d/supervisord_ec2init.conf
COPY docker/server/config/supervisord/supervisord_cron.conf /etc/supervisor/conf.d/supervisord_cron.conf
COPY --chown=nobody www/ /var/www/webpagetest
COPY docker/server/config/locations.ini /var/www/webpagetest/settings/locations.ini
COPY docker/server/config/connectivity.ini /var/www/webpagetest/settings/connectivity.ini
#COPY docker/server/config/settings.ini /var/www/webpagetest/settings/settings.ini
COPY docker/server/config/mobile_devices.ini /var/www/webpagetest/settings/mobile_devices.ini
COPY docker/server/config/video.ini /var/www/webpagetest/settings/video.ini
COPY docker/server/scripts/ /scripts/
RUN chmod 755 /scripts/* \
&& chown -R nobody.nobody /run \
&& mkdir -p /var/www/webpagetest/results \
&& chown -R nobody.nobody /var/www/webpagetest/results \
&& mkdir -p /var/www/webpagetest/work/video \
&& chown -R nobody.nobody /var/www/webpagetest/work/video \
&& chown -R nobody.nobody /var/www/webpagetest/settings/ \
&& crontab /etc/crontab
USER nobody
WORKDIR /var/www/webpagetest
EXPOSE 9000
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]