Skip to content
Snippets Groups Projects
Commit 5b678936 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

docker php-fpm user can be configured in .env file

parent 305b210c
Branches
Tags
No related merge requests found
Pipeline #18360 passed with stage
in 17 minutes and 23 seconds
MARIADB_ROOT_PASSWORD=password
BOKEH_DATABASE=bokeh
WEB_PORT=80
WEB_HOST=localhost
\ No newline at end of file
WEB_HOST=localhost
GROUP_ID=1000
USER_ID=1000
USERNAME=webmaster
......@@ -14,7 +14,12 @@ services:
image: memcached
php:
build: ./php-fpm
build:
context: ./php-fpm
args:
- GROUP_ID
- USER_ID
- USERNAME
tty: true
depends_on:
- db
......
......@@ -4,6 +4,10 @@ ENV TERM=xterm
ENV DEBIAN_FRONTEND=noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true
ARG GROUP_ID
ARG USERNAME
ARG USER_ID
RUN sed -i 's/main/main contrib non-free/g' /etc/apt/sources.list
RUN apt-get update && \
apt-get install -y --no-install-recommends apt-utils apt-transport-https
......@@ -67,13 +71,13 @@ RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
RUN apt-get install -y --no-install-recommends graphviz \
&& apt-get -y autoclean && apt-get -y clean
RUN addgroup --system --gid 1000 webmaster \
&& adduser --system --home /home/webmaster --shell /bin/bash --disabled-password --gid 1000 --uid 1000 webmaster
RUN addgroup --gid ${GROUP_ID} ${USERNAME} \
&& adduser --home /home/${USERNAME} --shell /bin/bash --disabled-password --gid ${GROUP_ID} --uid ${USER_ID} ${USERNAME}
RUN mkdir /usr/local/lib/php/sessions \
&& chmod g-rs /usr/local/lib/php/sessions && chmod o-rx /usr/local/lib/php/sessions \
&& chmod g+wx /usr/local/lib/php/sessions && chmod o+wt /usr/local/lib/php/sessions \
&& chown webmaster:webmaster /usr/local/lib/php/sessions
&& chown ${USERNAME}:${USERNAME} /usr/local/lib/php/sessions
RUN wget -O /usr/local/bin/composer https://getcomposer.org/download/latest-stable/composer.phar \
&& chmod +x /usr/local/bin/composer
......@@ -109,6 +113,6 @@ EXPOSE 9000
COPY php.ini /usr/local/etc/php/php.ini
COPY php-fpm.conf /usr/local/etc/php-fpm.conf
RUN sed -i "s:USERNAME:${USERNAME}:" /usr/local/etc/php-fpm.conf
CMD ["php-fpm", "-F"]
......@@ -8,7 +8,7 @@ rlimit_core = unlimited
events.mechanism = epoll
[bokeh]
user = webmaster
user = USERNAME
listen = [::]:9000
listen.mode = 0666
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment