-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
70 lines (56 loc) · 1.84 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
FROM php:8.2-apache
# Arguments
ARG user=forus
ARG uid=1000
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
libjpeg-dev \
libwebp-dev \
zip \
unzip \
nano \
iputils-ping \
net-tools \
mc \
wget \
locales \
libzip-dev \
libfreetype6-dev \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg --with-webp \
&& docker-php-ext-install -j$(nproc) gd \
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath zip intl soap
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Create system 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
# Copy commands
COPY docker/docker-compose/cmd/start-schedule.sh /usr/local/bin/start-schedule
RUN chmod +x /usr/local/bin/start-schedule
# Apache2 conf
ENV APACHE_DOCUMENT_ROOT=/var/www/public
COPY docker/docker-compose/apache2/default.conf /etc/apache2/sites-available/000-default.conf
RUN a2enmod rewrite headers
# PHP ini config
COPY docker/docker-compose/php/php.ini /usr/local/etc/php/conf.d/php.ini
# Copy data
COPY --chown=$user:www-data . /var/www
# Set working directory
WORKDIR /var/www
# Set permissions for project files
RUN find . -type f -exec chmod 664 {} \; | find . -type d -exec chmod 775 {} \;
RUN chgrp -R www-data ./storage ./bootstrap/cache | chmod -R ug+rwx ./storage ./bootstrap/cache
# Set user
USER $user
# Install composer dependency, copy env and set app key
RUN composer install && cp -n .env.docker .env && php artisan key:generate && php artisan storage:link
EXPOSE 8000