-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
112 lines (86 loc) · 2.57 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
FROM php:8.0-apache
# Arguments defined in docker-compose.yml
ARG user
ARG uid
# Install system dependencies
RUN apt-get update && apt-get install -y \
git\
zip \
wget \
curl \
procps \
wget\
htop \
unzip \
libzip-dev\
libssh-dev \
libjpeg-dev \
libbz2-dev\
libssl-dev \
libpng-dev \
libonig-dev \
libmcrypt-dev \
libxml2-dev \
librabbitmq-dev \
libreadline-dev \
libfreetype6-dev \
libicu-dev \
g++
# Point to Public Dir for Laravel App
ENV APACHE_DOCUMENT_ROOT=/var/www/html/public
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
# MOD REWRITE
RUN a2enmod rewrite headers
# Fetching Extensions Manually
# Get Redis And Put it in a Dir For Direct Install
RUN mkdir -p /usr/src/php/ext/redis
RUN curl -fsSL https://pecl.php.net/get/redis --ipv4 | tar xvz -C "/usr/src/php/ext/redis" --strip 1
# Get MongoDb And Put it in a Dir For Direct Install
RUN mkdir -p /usr/src/php/ext/mongodb
RUN curl -fsSL https://pecl.php.net/get/mongodb --ipv4 | tar xvz -C "/usr/src/php/ext/mongodb" --strip 1
# Get Amqp And Put it in a Dir For Direct Install
RUN mkdir -p /usr/src/php/ext/amqp
RUN curl -fsSL https://pecl.php.net/get/amqp --ipv4 | tar xvz -C "/usr/src/php/ext/amqp" --strip 1
# Get Amqp And Put it in a Dir For Direct Install
RUN mkdir -p /usr/src/php/ext/swoole
RUN curl -fsSL https://pecl.php.net/get/swoole --ipv4 | tar xvz -C "/usr/src/php/ext/swoole" --strip 1
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install PHP extensions **(Redis, Mongo, Amqp will only work for PHP 8 within this block)
RUN docker-php-ext-install \
gd \
bz2 \
intl \
redis \
swoole \
zip\
amqp\
exif \
iconv \
mongodb\
pcntl \
bcmath \
opcache \
calendar \
pdo_mysql \
mbstring \
sockets
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Pull NodeJs From REPO
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash
# Install NodeJs
RUN apt-get install nodejs
# 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 Everything from local to docker-volume
COPY ./ /var/www/html
# Set working directory
WORKDIR /var/www/html
# Set User
USER $user
# Expose Port for Forwarding
EXPOSE 80