FROM php:7.3-fpm-alpine
-MAINTAINER "Jérôme Jutteau <mojo@jirafeau.net>"
+MAINTAINER "Jérôme Jutteau <jerome@jutteau.fr>"
+# lighttpd user
+ARG USER_UID=100
+# www-data group
+ARG GROUP_UID=82
+
+# install base
RUN apk update && \
- apk add lighttpd git && \
ln -snf /usr/share/zoneinfo/Etc/UTC /etc/localtime && \
- echo "UTC" > /etc/timezone && \
- mkdir -p /usr/local/etc/php / && \
- mkdir /www
+ echo "UTC" > /etc/timezone
-WORKDIR /www
+# install jirafeau
+RUN mkdir /www
+WORKDIR /www
COPY .git .git
-RUN git reset --hard && rm -rf .git .gitignore .gitlab-ci.yml CONTRIBUTING.md Dockerfile README.md
+RUN apk add git && \
+ git reset --hard && rm -rf docker .git .gitignore .gitlab-ci.yml CONTRIBUTING.md Dockerfile README.md && \
+ apk del git && \
+ chown -R $USER_UID.$GROUP_UID /www && \
+ chmod o=,ug=rwX -R /www
+
+COPY docker/cleanup.sh /cleanup.sh
+RUN chmod o=,ug=rx /cleanup.sh
+COPY docker/run.sh /run.sh
+RUN chmod o=,ug=rx /run.sh
+
+# install lighttpd
+RUN apk add lighttpd php7-mcrypt && \
+ echo "extension=/usr/lib/php7/modules/mcrypt.so" > /usr/local/etc/php/conf.d/mcrypt.ini && \
+ chown -R $USER_UID /var/log/lighttpd && \
+ chmod oug=rwX /run && \
+ mkdir -p /usr/local/etc/php
COPY docker/php.ini /usr/local/etc/php/php.ini
COPY docker/lighttpd.conf /etc/lighttpd/lighttpd.conf
-RUN chown -R www-data. . && \
- chmod o=,ug=rwX -R . && \
- apk del git && \
- rm -rf /var/cache/apk/*
-CMD php-fpm -D && lighttpd -D -f /etc/lighttpd/lighttpd.conf
-EXPOSE 80
+# cleanup
+RUN rm -rf /var/cache/apk/*
+
+
+CMD /run.sh
+EXPOSE 80
\ No newline at end of file