forked from guessi/docker-yourls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
54 lines (43 loc) · 2.55 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
FROM php:7.4-apache-buster
RUN sed -i -e '/^ServerTokens/s/^.*$/ServerTokens Prod/g' \
-e '/^ServerSignature/s/^.*$/ServerSignature Off/g' \
/etc/apache2/conf-available/security.conf
RUN echo "expose_php=Off" > /usr/local/etc/php/conf.d/php-hide-version.ini
RUN apt update && apt install -y --no-install-recommends libonig-dev
RUN docker-php-ext-install pdo_mysql mysqli mbstring && \
a2enmod rewrite ssl
ENV YOURLS_VERSION 1.8.1
ENV YOURLS_PACKAGE https://github.com/YOURLS/YOURLS/archive/${YOURLS_VERSION}.tar.gz
ENV YOURLS_CHECKSUM 0d9106b2936289d2fe5d4d6c017a77f96c79f4b2cacf1b59a0837d0032ca96d7
RUN mkdir -p /opt/yourls && \
curl -sSL ${YOURLS_PACKAGE} -o /tmp/yourls.tar.gz && \
echo "${YOURLS_CHECKSUM} /tmp/yourls.tar.gz" | sha256sum -c - && \
tar xf /tmp/yourls.tar.gz --strip-components=1 --directory=/opt/yourls && \
rm -rf /tmp/yourls.tar.gz
WORKDIR /opt/yourls
ADD https://github.com/dgw/yourls-dont-track-admins/archive/master.tar.gz \
/opt/dont-track-admins.tar.gz
ADD https://github.com/timcrockford/302-instead/archive/master.tar.gz \
/opt/302-instead.tar.gz
ADD https://github.com/YOURLS/force-lowercase/archive/master.tar.gz \
/opt/force-lowercase.tar.gz
ADD https://github.com/guessi/yourls-mobile-detect/archive/master.tar.gz \
/opt/mobile-detect.tar.gz
ADD https://github.com/YOURLS/dont-log-bots/archive/master.tar.gz \
/opt/dont-log-bots.tar.gz
ADD https://github.com/luixxiul/dont-log-crawlers/archive/master.tar.gz \
/opt/dont-log-crawlers.tar.gz
ADD https://github.com/guessi/yourls-dont-log-health-checker/archive/master.tar.gz \
/opt/dont-log-health-checker.tar.gz
RUN for i in $(ls /opt/*.tar.gz); do \
plugin_name="$(basename ${i} '.tar.gz')" ; \
mkdir -p user/plugins/${plugin_name} ; \
tar zxvf /opt/${plugin_name}.tar.gz \
--strip-components=1 \
-C user/plugins/${plugin_name} ; \
done
ADD conf/ /
# security enhancement: remove sample configs
RUN rm -rf user/config-sample.php \
user/plugins/sample* && \
(find . -type d -name ".git" -exec rm -rf {} +)