-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.web
60 lines (44 loc) · 1.65 KB
/
Dockerfile.web
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
FROM consultorio-medico/web:latest
# environment arguments
ARG UID
ARG GID
ARG USER
ENV UID=${UID}
ENV GID=${GID}
ENV USER=${USER}
ENV APP_HOME /var/www/html
# WORKDIR /var/www/html
WORKDIR $APP_HOME
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
# MacOS staff group's gid is 20, so is the dialout group in alpine linux. We're not using it, let's just remove it.
RUN delgroup dialout
# Creating user and group
RUN addgroup -g ${GID} --system ${USER}
RUN adduser -G ${USER} --system -D -s /bin/sh -u ${UID} ${USER}
# RUN sed -i "s/user = www-data/user = '${USER}'/g" /opt/docker/etc/php/fpm/php-fpm.conf
# RUN sed -i "s/group = www-data/group = '${USER}'/g" /opt/docker/etc/php/fpm/php-fpm.conf
# RUN echo "php_admin_flag[log_errors] = on" >> /usr/local/etc/php-fpm.d/www.conf
RUN sed -i "s/user nginx/user '${USER}'/g" /etc/nginx/nginx.conf
# add custom php-fpm pool settings, these get written at entrypoint startup
ENV FPM_PM_MAX_CHILDREN=20 \
FPM_PM_START_SERVERS=2 \
FPM_PM_MIN_SPARE_SERVERS=1 \
FPM_PM_MAX_SPARE_SERVERS=3
# copy entrypoint files
COPY ./Docker/entrypoints/docker-php-* /usr/local/bin/
# change permissions
RUN chmod +x /usr/local/bin/docker-php-*
# convert line endings to unix with dos2unix
RUN dos2unix /usr/local/bin/docker-php-entrypoint
RUN dos2unix /usr/local/bin/docker-php-entrypoint-dev
# copy nginx configuration
COPY ./Docker/nginx /etc/nginx
USER ${USERNAME}
COPY --chown=${USERNAME}:${USERNAME} . $APP_HOME/
RUN composer install --no-dev --optimize-autoloader
EXPOSE 80
# switch back to root
USER root
# run supervisor
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"]