-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
56 lines (41 loc) · 1.29 KB
/
Dockerfile
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
FROM php:8.2
ENV COMPOSER_MEMORY_LIMIT='-1'
ARG env
ARG user
ARG uid
RUN apt-get update && \
apt-get install -y --force-yes --no-install-recommends \
cron \
libzip-dev \
libcurl4-openssl-dev \
unzip \
git \
mariadb-client
# Install extentions
RUN docker-php-ext-install pdo_mysql zip curl
#####################################
# xDebug:
#####################################
RUN if [ "$env" = "local" ] ; then pecl install xdebug && docker-php-ext-enable xdebug ; fi
#####################################
# Composer:
#####################################
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Create user to run Composer and Artisan Commands
RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer && \
chown -R $user:$user /home/$user && \
mkdir /app && \
chown -R $user:$user /app
# Add crontab file in the cron directory for calling home
COPY ./crontab /etc/cron.d/cron
COPY ./cron.allow /etc/cron.d/cron.allow
RUN touch /var/run/crond.pid && \
chmod gu+rw /var/run && \
chmod gu+s /usr/sbin/cron
# Give execution rights on the cron job
RUN chmod 0644 /etc/cron.d/cron && \
crontab -u $user /etc/cron.d/cron
RUN rm -r /var/lib/apt/lists/*
WORKDIR /app
USER $user