1+ FROM php:7.4-apache
2+ MAINTAINER "Iordanis Kostelidis <
[email protected] >"
3+
4+ ARG APP_UID=1000
5+ ARG APP_GID=1000
6+
7+ ARG TIMEZONE=Europe/Athens
8+
9+ ENV LC_ALL=en_US.UTF-8
10+ ENV LANG=en_US.UTF-8
11+ ENV LANGUAGE=en_US.UTF-8
12+
13+ ENV DEBIAN_FRONTEND=noninteractive
14+ ARG PHP_INI_PROFILE=production
15+
16+ # Update the base image, set timezone and locales
17+ RUN apt-get update && apt-get upgrade -y \
18+ && apt-get -y install apt-utils \
19+ && apt-get -y install tzdata \
20+ && ln -fs /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
21+ && dpkg-reconfigure --frontend noninteractive tzdata \
22+ && apt-get install -y locales locales-all
23+
24+ # Install libcap (we need it to allow apache bind 80 port without root)
25+ RUN apt-get -y install libcap2 libcap2-bin
26+
27+ # Install application dependencies
28+ RUN apt-get -y install yaz xsltproc
29+
30+ # Clean up
31+ RUN apt-get clean && rm -rf /var/lib/apt/lists/*
32+
33+ # Setup apache and php
34+ RUN setcap 'cap_net_bind_service=+ep' /usr/sbin/apache2 \
35+ && a2enmod rewrite \
36+ && service apache2 restart \
37+ && cp /usr/local/etc/php/php.ini-${PHP_INI_PROFILE} /usr/local/etc/php/php.ini
38+
39+ # Create application user
40+ RUN groupadd -g "${APP_GID}" unimarc2marc21 \
41+ && useradd -u "${APP_UID}" -ms /bin/bash -g unimarc2marc21 unimarc2marc21 \
42+ && usermod -a -G unimarc2marc21 www-data
43+
44+ # Change default user
45+ USER unimarc2marc21
46+
47+ COPY --chown=unimarc2marc21:www-data ./www /var/www/html
0 commit comments