-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
executable file
·128 lines (96 loc) · 3.71 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
FROM php:7.2-apache
RUN apt-get -y update --fix-missing --no-install-recommends
RUN apt-get -y upgrade
# Install useful tools
RUN apt-get -yq install apt-utils nano wget dialog
# Install important libraries
RUN apt-get -y install --fix-missing -qq apt-utils build-essential git curl libcurl4 zip openssl
# Install xdebug
RUN pecl install xdebug-2.6.0
RUN docker-php-ext-enable xdebug
# 1. development packages
RUN apt-get install -y \
git \
zip \
curl \
sudo \
nano\
unzip \
libicu-dev \
libbz2-dev \
libpng-dev \
libjpeg-dev \
libmcrypt-dev \
libreadline-dev \
libfreetype6-dev \
software-properties-common\
g++
RUN apt-get clean
# 2. apache configs + document root
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
# 3. mod_rewrite for URL rewrite and mod_headers for .htaccess extra headers like Access-Control-Allow-Origin-
RUN a2enmod rewrite headers
# 4. start with base php config, then add extensions
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
#RUN git config --global url.”https://4038fc67cce42f31d82ced851db4fc45f261a804:@github.com/".insteadOf “https://github.com/"
# Clone our private GitHub Repository
#RUN git clone -b docker https://4038fc67cce42f31d82ced851db4fc45f261a804:[email protected]/egahmad/OuijaModuleActivity.git ./
#RUN cp -R /myapp/* /home/app/
#RUN chown app:app -R /home/app/
RUN apt-get -y install libsqlite3-dev libsqlite3-0 default-mysql-client
RUN docker-php-ext-install pdo_mysql
RUN docker-php-ext-install pdo_sqlite
RUN docker-php-ext-install mysqli
RUN docker-php-ext-install tokenizer
RUN docker-php-ext-install json
RUN apt-get -y install zlib1g-dev
RUN docker-php-ext-install zip
RUN apt-get -y install libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN docker-php-ext-install mbstring
RUN docker-php-ext-install gettext
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install -j$(nproc) gd
RUN apt-get update && apt-get install -y libc-client-dev libkrb5-dev && rm -r /var/lib/apt/lists/*
RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
&& docker-php-ext-install imap
# Enable apache modules
RUN a2enmod rewrite headers
RUN docker-php-ext-install \
bz2 \
iconv \
bcmath \
opcache \
calendar
# 5. composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# 6. Install Laravel Envoy
RUN composer global require "laravel/envoy"
# 7. we need a user with the same UID/GID with host user
# so when we execute CLI commands, all the host file's ownership remains intact
# otherwise command from inside container will create root-owned files and directories
ARG uid
RUN useradd -G www-data,root -u 1000 -d /home/devuser devuser
RUN mkdir -p /home/devuser/.composer && \
chown -R devuser:devuser /home/devuser
# 8. private keys
#ARG SSH_KEY
#ARG SSH_KEY_PASSPHRASE
#RUN mkdir -p /root/.ssh && \
# chmod 0700 /root/.ssh && \
# ssh-keyscan github.com > /root/.ssh/known_hosts && \
# echo "${SSH_KEY}" > /root/.ssh/id_rsa && \
# chmod 600 /root/.ssh/id_rsa
#RUN git config --global user.name "egahmad"
#RUN git config --global user.password "!Wolfandman1542"
#RUN git remote set-url origin [email protected]:egahmad/OuijaCRM.git
#RUN git clone https://github.com/egahmad/OuijaCRM.git
WORKDIR /var/www/html/
COPY . "/var/www/html/"
RUN mv .env.prod .env
RUN composer update
RUN composer install
RUN php artisan key:generate