-
Notifications
You must be signed in to change notification settings - Fork 0
/
php-cli.docker
35 lines (23 loc) · 1.02 KB
/
php-cli.docker
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
FROM php:8.1-cli
ARG USER_ID
ARG GROUP_ID
RUN apt-get update && apt-get install -y libzip-dev zip unzip libpq-dev
RUN php -r "copy ('https://getcomposer.org/installer', '/var/composer-setup.php');" && php /var/composer-setup.php --install-dir=/usr/bin/ --filename=composer
RUN docker-php-ext-configure pgsql -with-pgsql
RUN docker-php-ext-install pdo pdo_pgsql pgsql zip
RUN if [ ${USER_ID:-0} -ne 0 ] && [ ${GROUP_ID:-0} -ne 0 ]; then \
userdel -f www-data &&\
if getent group www-data ; then groupdel www-data; fi &&\
groupadd -g ${GROUP_ID} www-data &&\
useradd -l -u ${USER_ID} -g www-data www-data &&\
install -d -m 0755 -o www-data -g www-data /var/www &&\
chown --changes --silent --no-dereference --recursive \
--from=33:33 ${USER_ID}:${GROUP_ID} \
/var/www \
;fi
RUN mkdir -p /home/www-data/.config/psysh &&\
chmod -R 755 /home/www-data/.config &&\
chown -R www-data:www-data /home/www-data
USER www-data
RUN echo 'alias pa="php artisan"' >> ~/.bashrc
WORKDIR /var/www