-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathDockerfile
More file actions
78 lines (62 loc) · 1.8 KB
/
Copy pathDockerfile
File metadata and controls
78 lines (62 loc) · 1.8 KB
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
71
72
73
74
75
76
77
78
FROM php:8.0-apache
# set the application folder as env variable
ENV APP_HOME /var/www/html
# Remove the custom PHP sources -> this allows us to install "php-mysql"
RUN rm /etc/apt/preferences.d/no-debian-php
# Install system dependencies
RUN curl -L https://deb.nodesource.com/setup_16.x | bash
RUN apt-get update
RUN apt-get install -y \
jpegoptim optipng pngquant gifsicle \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libwebp-dev \
libonig-dev \
libxml2-dev \
php-mysql \
nodejs \
git \
zip unzip \
sudo
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN pecl install redis
RUN rm -rf /tmp/pear
RUN docker-php-ext-enable redis
RUN docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
--with-webp
RUN docker-php-ext-install -j$(nproc) \
bcmath \
pdo \
pdo_mysql \
mysqli \
intl \
pcntl \
opcache \
exif \
gd
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# change uid/gid of apache to docker user
RUN usermod -u 1000 www-data && groupmod -g 1000 www-data
# change the web root to /var/www/html/public and port to 8080
RUN sed -i -e "s/html/html\/public/g" /etc/apache2/sites-enabled/000-default.conf
RUN sed -i -e "s/80/8080/g" /etc/apache2/sites-enabled/000-default.conf
# enable apache module rewrite
RUN a2enmod rewrite
# copy source files and run composer
COPY . $APP_HOME
# Get init data
COPY storage/docker/root /
RUN chmod a+x /usr/local/bin/entrypoint.sh
RUN chown www-data:www-data /etc/apache2/ports.conf
# Install dependencies
RUN composer install --optimize-autoloader --no-dev
RUN npm install
# change ownership of our applications
RUN chown -R www-data:www-data $APP_HOME
ENTRYPOINT /usr/local/bin/entrypoint.sh