Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
7b9ec17d8d | |||
18b38db037 | |||
adfb468913 | |||
43f4211abb | |||
b1b8585518 | |||
d8fd1a5de0 | |||
585baf0668 | |||
f99eff3a99 | |||
ff4b913396 | |||
e861348475 |
@ -1,112 +1,118 @@
|
|||||||
#### Install Docker
|
#### Install Docker
|
||||||
```
|
|
||||||
Login Digital Ocean
|
- Visit [DigitalOcean](https://cloud.digitalocean.com/login) and login.
|
||||||
Add Droplet
|
- Click the `Create Droplet` button.
|
||||||
1 Click Install docker
|
- Open the `One-click apps` tab.
|
||||||
Choose Droplet
|
- Select Docker with your preferred version.
|
||||||
reset ROOT password
|
- Continue creating the droplet as you normally would.
|
||||||
check email
|
- If needed, check your e-mail for the droplet root password.
|
||||||
```
|
|
||||||
|
|
||||||
#### SSH to your Server
|
#### SSH to your Server
|
||||||
|
|
||||||
|
Find the IP address of the droplet in the DigitalOcean interface. Use it to connect to the server.
|
||||||
|
|
||||||
```
|
```
|
||||||
ssh root@ipaddress
|
ssh root@ipaddress
|
||||||
```
|
```
|
||||||
you will be prompt of that password.
|
|
||||||
type the password you receive in your email
|
|
||||||
|
|
||||||
then it will ask to you to change a new password
|
You may be prompted for a password. Type the one you found within your e-mailbox. It'll then ask you to change the password.
|
||||||
just change it to the custom root password you want
|
|
||||||
|
|
||||||
After SSH
|
You can now check if Docker is available:
|
||||||
you can check that docker command is working by typing
|
|
||||||
|
|
||||||
```
|
```
|
||||||
$root@midascode:~# docker
|
$root@server:~# docker
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Set Up Your Laravel Project
|
#### Set Up Your Laravel Project
|
||||||
|
|
||||||
```
|
```
|
||||||
$root@midascode:~# apt-get install git
|
$root@server:~# apt-get install git
|
||||||
$root@midascode:~# git clone https://github.com/laravel/laravel
|
$root@server:~# git clone https://github.com/laravel/laravel
|
||||||
$root@midascode:~# cd laravel
|
$root@server:~# cd laravel
|
||||||
$root@midascode:~/laravel/ git submodule add https://github.com/LaraDock/laradock.git
|
$root@server:~/laravel/ git submodule add https://github.com/LaraDock/laradock.git
|
||||||
$root@midascode:~/laravel/ cd laradock
|
$root@server:~/laravel/ cd laradock
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Install docker-compose command
|
#### Install docker-compose command
|
||||||
|
|
||||||
```
|
```
|
||||||
$root@midascode:~/laravel/laradock# curl -L https://github.com/docker/compose/releases/download/1.8.0/run.sh > /usr/local/bin/docker-compose
|
$root@server:~/laravel/laradock# curl -L https://github.com/docker/compose/releases/download/1.8.0/run.sh > /usr/local/bin/docker-compose
|
||||||
$root@midascode:~/chmod +x /usr/local/bin/docker-compose
|
$root@server:~/chmod +x /usr/local/bin/docker-compose
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Create Your LaraDock Containers
|
#### Create Your LaraDock Containers
|
||||||
|
|
||||||
```
|
```
|
||||||
$root@midascode:~/laravel/laradock# docker-compose up -d nginx mysql
|
$root@server:~/laravel/laradock# docker-compose up -d nginx mysql
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that more containers are available, find them in the [docs](http://laradock.io/introduction/#supported-software-containers) or the `docker-compose.yml` file.
|
||||||
|
|
||||||
#### Go to Your Workspace
|
#### Go to Your Workspace
|
||||||
|
|
||||||
```
|
```
|
||||||
docker-compose exec workspace bash
|
docker-compose exec workspace bash
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Install laravel Dependencies, Add .env , generate Key and give proper permission certain folder
|
#### Install and configure Laravel
|
||||||
|
|
||||||
|
Let's install Laravel's dependencies, add the `.env` file, generate the key and give proper permissions to the cache folder.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ root@0e77851d27d3:/var/www# composer install
|
$ root@workspace:/var/www# composer install
|
||||||
$ root@0e77851d27d3:/var/www# cp .env.example .env
|
$ root@workspace:/var/www# cp .env.example .env
|
||||||
$ root@0e77851d27d3:/var/www# php artisan key:generate
|
$ root@workspace:/var/www# php artisan key:generate
|
||||||
$ root@0e77851d27d3:/var/www# exit
|
$ root@workspace:/var/www# exit
|
||||||
$root@midascode:~/laravel/laradock# cd ..
|
$root@server:~/laravel/laradock# cd ..
|
||||||
$root@midascode:~/laravel# sudo chmod -R 777 storage bootstrap/cache
|
$root@server:~/laravel# sudo chmod -R 777 storage bootstrap/cache
|
||||||
```
|
```
|
||||||
|
|
||||||
you can then view your laravel site at your ipaddress
|
You can then view your Laravel site by visiting the IP address of your server in your browser. For example:
|
||||||
for example
|
|
||||||
```
|
```
|
||||||
192.168.1.1
|
http://192.168.1.1
|
||||||
```
|
```
|
||||||
|
|
||||||
You will see there Laravel Default Welcome Page
|
It should show you the Laravel default welcome page.
|
||||||
|
|
||||||
but if you need to view on your custom domain name
|
However, we want it to show up using your custom domain name, as well.
|
||||||
which you would.
|
|
||||||
|
|
||||||
#### Using Your Own Domain Name
|
#### Using Your Own Domain Name
|
||||||
login to your DNS provider
|
|
||||||
Godaddy, Namecheap what ever...
|
Login to your DNS provider, such as Godaddy, Namecheap.
|
||||||
And Point the Custom Domain Name Server to
|
|
||||||
|
Point the Custom Domain Name Server to:
|
||||||
|
|
||||||
```
|
```
|
||||||
ns1.digitalocean.com
|
ns1.digitalocean.com
|
||||||
ns2.digitalocean.com
|
ns2.digitalocean.com
|
||||||
ns3.digitalocean.com
|
ns3.digitalocean.com
|
||||||
```
|
```
|
||||||
In Your Digital Ocean Account go to
|
|
||||||
```
|
|
||||||
https://cloud.digitalocean.com/networking/domains
|
|
||||||
```
|
|
||||||
add your domain name and choose the server ip you provision earlier
|
|
||||||
|
|
||||||
#### Serve Site With NGINX (HTTP ONLY)
|
Within DigitalOcean, you'll need to change some settings, too.
|
||||||
Go back to command line
|
|
||||||
|
Visit: https://cloud.digitalocean.com/networking/domains
|
||||||
|
|
||||||
|
Add your domain name and choose the server IP you'd provision earlier.
|
||||||
|
|
||||||
|
#### Serving Site With NGINX (HTTP ONLY)
|
||||||
|
|
||||||
|
Go back to command line.
|
||||||
|
|
||||||
```
|
```
|
||||||
$root@midascode:~/laravel/laradock# cd nginx
|
$root@server:~/laravel/laradock# cd nginx
|
||||||
$root@midascode:~/laravel/laradock/nginx# vim laravel.conf
|
$root@server:~/laravel/laradock/nginx# vim laravel.conf
|
||||||
```
|
|
||||||
remove default_server
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Remove `default_server`
|
||||||
|
|
||||||
|
```
|
||||||
listen 80 default_server;
|
listen 80 default_server;
|
||||||
listen [::]:80 default_server ipv6only=on;
|
listen [::]:80 default_server ipv6only=on;
|
||||||
|
|
||||||
```
|
```
|
||||||
and add server_name (your custom domain)
|
|
||||||
|
And add `server_name` (your custom domain)
|
||||||
|
|
||||||
```
|
```
|
||||||
listen 80;
|
listen 80;
|
||||||
listen [::]:80 ipv6only=on;
|
listen [::]:80 ipv6only=on;
|
||||||
@ -114,27 +120,29 @@ remove default_server
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### Rebuild Your Nginx
|
#### Rebuild Your Nginx
|
||||||
|
|
||||||
```
|
```
|
||||||
$root@midascode:~/laravel/laradock/nginx# docker-compose down
|
$root@server:~/laravel/laradock/nginx# docker-compose down
|
||||||
$root@midascode:~/laravel/laradock/nginx# docker-compose build nginx
|
$root@server:~/laravel/laradock/nginx# docker-compose build nginx
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Re Run Your Containers MYSQL and NGINX
|
#### Re Run Your Containers MYSQL and NGINX
|
||||||
|
|
||||||
```
|
```
|
||||||
$root@midascode:~/laravel/laradock/nginx# docker-compose up -d nginx mysql
|
$root@server:~/laravel/laradock/nginx# docker-compose up -d nginx mysql
|
||||||
```
|
```
|
||||||
|
|
||||||
###### View Your Site with HTTP ONLY (http://yourdomain.com)
|
**View Your Site with HTTP ONLY (http://yourdomain.com)**
|
||||||
|
|
||||||
#### Run Site on SSL with Let's Encrypt Certificate
|
#### Run Site on SSL with Let's Encrypt Certificate
|
||||||
|
|
||||||
###### Note: You need to Use Caddy here Instead of Nginx
|
**Note: You need to Use Caddy here Instead of Nginx**
|
||||||
|
|
||||||
###### To go Caddy Folders and Edit CaddyFile
|
To go Caddy Folders and Edit CaddyFile
|
||||||
|
|
||||||
```
|
```
|
||||||
$root@midascode:~/laravel/laradock# cd caddy
|
$root@server:~/laravel/laradock# cd caddy
|
||||||
$root@midascode:~/laravel/laradock/caddy# vim Caddyfile
|
$root@server:~/laravel/laradock/caddy# vim Caddyfile
|
||||||
```
|
```
|
||||||
|
|
||||||
Remove 0.0.0.0:80
|
Remove 0.0.0.0:80
|
||||||
@ -142,32 +150,37 @@ Remove 0.0.0.0:80
|
|||||||
```
|
```
|
||||||
0.0.0.0:80
|
0.0.0.0:80
|
||||||
root /var/www/public
|
root /var/www/public
|
||||||
```
|
```
|
||||||
|
|
||||||
and replace with your https://yourdomain.com
|
and replace with your https://yourdomain.com
|
||||||
|
|
||||||
```
|
```
|
||||||
https://yourdomain.com
|
https://yourdomain.com
|
||||||
root /var/www/public
|
root /var/www/public
|
||||||
```
|
```
|
||||||
|
|
||||||
uncomment tls
|
uncomment tls
|
||||||
|
|
||||||
```
|
```
|
||||||
#tls self-signed
|
#tls self-signed
|
||||||
```
|
```
|
||||||
|
|
||||||
and replace self-signed with your email address
|
and replace self-signed with your email address
|
||||||
|
|
||||||
```
|
```
|
||||||
tls midascodebreaker@gmai.com
|
tls serverbreaker@gmai.com
|
||||||
```
|
```
|
||||||
|
|
||||||
This is needed Prior to Creating Let's Encypt
|
This is needed Prior to Creating Let's Encypt
|
||||||
|
|
||||||
#### Run Your Caddy Container without the -d flag and Generate SSL with Let's Encrypt
|
#### Run Your Caddy Container without the -d flag and Generate SSL with Let's Encrypt
|
||||||
|
|
||||||
```
|
```
|
||||||
$root@midascode:~/laravel/laradock/caddy# docker-compose up caddy
|
$root@server:~/laravel/laradock/caddy# docker-compose up caddy
|
||||||
```
|
```
|
||||||
|
|
||||||
you will be prompt here to enter your email... you may enter it or not
|
You'll be prompt here to enter your email... you may enter it or not
|
||||||
|
|
||||||
```
|
```
|
||||||
Attaching to laradock_mysql_1, laradock_caddy_1
|
Attaching to laradock_mysql_1, laradock_caddy_1
|
||||||
caddy_1 | Activating privacy features...
|
caddy_1 | Activating privacy features...
|
||||||
@ -179,17 +192,18 @@ caddy_1 | https://yourdomain.com
|
|||||||
caddy_1 | http://yourdomain.com
|
caddy_1 | http://yourdomain.com
|
||||||
```
|
```
|
||||||
|
|
||||||
After it finish Press Ctrl + C to exit ...
|
After it finishes, press `Ctrl` + `C` to exit.
|
||||||
|
|
||||||
#### Stop All Containers and ReRun Caddy and Other Containers on Background
|
#### Stop All Containers and ReRun Caddy and Other Containers on Background
|
||||||
|
|
||||||
```
|
```
|
||||||
$root@midascode:~/laravel/laradock/caddy# docker-compose down
|
$root@server:~/laravel/laradock/caddy# docker-compose down
|
||||||
$root@midascode:~/laravel/laradock/caddy# docker-compose up -d mysql caddy
|
$root@server:~/laravel/laradock/caddy# docker-compose up -d mysql caddy
|
||||||
```
|
```
|
||||||
|
|
||||||
View your Site in the Browser Securely Using HTTPS (https://yourdomain.com)
|
View your Site in the Browser Securely Using HTTPS (https://yourdomain.com)
|
||||||
|
|
||||||
##### Note that Certificate will be Automatically Renew By Caddy
|
**Note that Certificate will be Automatically Renew By Caddy**
|
||||||
|
|
||||||
>References:
|
>References:
|
||||||
>
|
>
|
||||||
@ -200,14 +214,3 @@ View your Site in the Browser Securely Using HTTPS (https://yourdomain.com)
|
|||||||
- [https://caddyserver.com/docs/automatic-https](https://caddyserver.com/docs/automatic-https)
|
- [https://caddyserver.com/docs/automatic-https](https://caddyserver.com/docs/automatic-https)
|
||||||
- [https://caddyserver.com/docs/tls](https://caddyserver.com/docs/tls)
|
- [https://caddyserver.com/docs/tls](https://caddyserver.com/docs/tls)
|
||||||
- [https://caddyserver.com/docs/caddyfile](https://caddyserver.com/docs/caddyfile)
|
- [https://caddyserver.com/docs/caddyfile](https://caddyserver.com/docs/caddyfile)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ services:
|
|||||||
- NODE_VERSION=${WORKSPACE_NODE_VERSION}
|
- NODE_VERSION=${WORKSPACE_NODE_VERSION}
|
||||||
- YARN_VERSION=${WORKSPACE_YARN_VERSION}
|
- YARN_VERSION=${WORKSPACE_YARN_VERSION}
|
||||||
- TZ=${WORKSPACE_TIMEZONE}
|
- TZ=${WORKSPACE_TIMEZONE}
|
||||||
|
dockerfile: "dockerfile-${PHP_VERSION}"
|
||||||
volumes_from:
|
volumes_from:
|
||||||
- applications
|
- applications
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
@ -64,7 +65,7 @@ services:
|
|||||||
- INSTALL_MYSQLI=${PHP_FPM_INSTALL_MYSQLI}
|
- INSTALL_MYSQLI=${PHP_FPM_INSTALL_MYSQLI}
|
||||||
- INSTALL_TOKENIZER=${PHP_FPM_INSTALL_TOKENIZER}
|
- INSTALL_TOKENIZER=${PHP_FPM_INSTALL_TOKENIZER}
|
||||||
- INSTALL_INTL=${PHP_FPM_INSTALL_INTL}
|
- INSTALL_INTL=${PHP_FPM_INSTALL_INTL}
|
||||||
dockerfile: ${PHP_FPM_DOCKER_FILE}
|
dockerfile: "dockerfile-${PHP_VERSION}"
|
||||||
volumes_from:
|
volumes_from:
|
||||||
- applications
|
- applications
|
||||||
expose:
|
expose:
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
APPLICATION=../
|
APPLICATION=../
|
||||||
|
|
||||||
### PHP version (Does not apply for HHVM)
|
### PHP version (Does not apply for HHVM)
|
||||||
# PHP_VERSION=55
|
|
||||||
# PHP_VERSION=56
|
# PHP_VERSION=56
|
||||||
PHP_VERSION=70
|
PHP_VERSION=70
|
||||||
|
# PHP_VERSION=71
|
||||||
|
|
||||||
### PHP interpreter
|
### PHP interpreter
|
||||||
# PHP_INTERPRETER=hhvm
|
# PHP_INTERPRETER=hhvm
|
||||||
@ -34,7 +34,6 @@ WORKSPACE_TIMEZONE=UTC
|
|||||||
WORKSPACE_SSH_PORT=2222
|
WORKSPACE_SSH_PORT=2222
|
||||||
|
|
||||||
### PHP_FPM Container
|
### PHP_FPM Container
|
||||||
PHP_FPM_DOCKER_FILE=Dockerfile-70
|
|
||||||
PHP_FPM_INSTALL_XDEBUG=false
|
PHP_FPM_INSTALL_XDEBUG=false
|
||||||
PHP_FPM_INSTALL_MONGO=false
|
PHP_FPM_INSTALL_MONGO=false
|
||||||
PHP_FPM_INSTALL_SOAP=false
|
PHP_FPM_INSTALL_SOAP=false
|
||||||
@ -46,6 +45,7 @@ PHP_FPM_INSTALL_OPCACHE=false
|
|||||||
PHP_FPM_INSTALL_EXIF=false
|
PHP_FPM_INSTALL_EXIF=false
|
||||||
PHP_FPM_INSTALL_AEROSPIKE_EXTENSION=false
|
PHP_FPM_INSTALL_AEROSPIKE_EXTENSION=false
|
||||||
PHP_FPM_INSTALL_MYSQLI=false
|
PHP_FPM_INSTALL_MYSQLI=false
|
||||||
|
PHP_FPM_INSTALL_MYSQL=false
|
||||||
PHP_FPM_INSTALL_TOKENIZER=false
|
PHP_FPM_INSTALL_TOKENIZER=false
|
||||||
PHP_FPM_INSTALL_INTL=false
|
PHP_FPM_INSTALL_INTL=false
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ http {
|
|||||||
client_max_body_size 20M;
|
client_max_body_size 20M;
|
||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
default_type application/octet-stream;
|
default_type application/octet-stream;
|
||||||
access_log /var/log/nginx/access.log;
|
access_log /dev/stdout;
|
||||||
error_log /var/log/nginx/error.log;
|
error_log /dev/stderr;
|
||||||
gzip on;
|
gzip on;
|
||||||
gzip_disable "msie6";
|
gzip_disable "msie6";
|
||||||
|
|
||||||
|
@ -108,6 +108,20 @@ RUN if [ ${INSTALL_MEMCACHED} = true ]; then \
|
|||||||
docker-php-ext-enable memcached \
|
docker-php-ext-enable memcached \
|
||||||
;fi
|
;fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# PHP MySQL:
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
ARG INSTALL_MYSQL=false
|
||||||
|
COPY ./mysql.ini /usr/local/etc/php/conf.d/mysql.ini
|
||||||
|
RUN if [ ${INSTALL_MYSQL} = true ]; then \
|
||||||
|
# Install the php mysql extension
|
||||||
|
docker-php-ext-install mysql && \
|
||||||
|
docker-php-ext-install mysqli && \
|
||||||
|
docker-php-ext-enable mysql && \
|
||||||
|
docker-php-ext-enable mysqli \
|
||||||
|
;fi
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
# PHP Aerospike:
|
# PHP Aerospike:
|
||||||
#####################################
|
#####################################
|
||||||
|
58
php-fpm/mysql.ini
Normal file
58
php-fpm/mysql.ini
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
[MySQL]
|
||||||
|
; Allow accessing, from PHP's perspective, local files with LOAD DATA statements
|
||||||
|
; http://php.net/mysql.allow_local_infile
|
||||||
|
mysql.allow_local_infile = On
|
||||||
|
|
||||||
|
; Allow or prevent persistent links.
|
||||||
|
; http://php.net/mysql.allow-persistent
|
||||||
|
mysql.allow_persistent = On
|
||||||
|
|
||||||
|
; If mysqlnd is used: Number of cache slots for the internal result set cache
|
||||||
|
; http://php.net/mysql.cache_size
|
||||||
|
mysql.cache_size = 2000
|
||||||
|
|
||||||
|
; Maximum number of persistent links. -1 means no limit.
|
||||||
|
; http://php.net/mysql.max-persistent
|
||||||
|
mysql.max_persistent = -1
|
||||||
|
|
||||||
|
; Maximum number of links (persistent + non-persistent). -1 means no limit.
|
||||||
|
; http://php.net/mysql.max-links
|
||||||
|
mysql.max_links = -1
|
||||||
|
|
||||||
|
; Default port number for mysql_connect(). If unset, mysql_connect() will use
|
||||||
|
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
|
||||||
|
; compile-time value defined MYSQL_PORT (in that order). Win32 will only look
|
||||||
|
; at MYSQL_PORT.
|
||||||
|
; http://php.net/mysql.default-port
|
||||||
|
mysql.default_port =
|
||||||
|
|
||||||
|
; Default socket name for local MySQL connects. If empty, uses the built-in
|
||||||
|
; MySQL defaults.
|
||||||
|
; http://php.net/mysql.default-socket
|
||||||
|
mysql.default_socket =
|
||||||
|
|
||||||
|
; Default host for mysql_connect() (doesn't apply in safe mode).
|
||||||
|
; http://php.net/mysql.default-host
|
||||||
|
mysql.default_host =
|
||||||
|
|
||||||
|
; Default user for mysql_connect() (doesn't apply in safe mode).
|
||||||
|
; http://php.net/mysql.default-user
|
||||||
|
mysql.default_user =
|
||||||
|
|
||||||
|
; Default password for mysql_connect() (doesn't apply in safe mode).
|
||||||
|
; Note that this is generally a *bad* idea to store passwords in this file.
|
||||||
|
; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")
|
||||||
|
; and reveal this password! And of course, any users with read access to this
|
||||||
|
; file will be able to reveal the password as well.
|
||||||
|
; http://php.net/mysql.default-password
|
||||||
|
mysql.default_password =
|
||||||
|
|
||||||
|
; Maximum time (in seconds) for connect timeout. -1 means no limit
|
||||||
|
; http://php.net/mysql.connect-timeout
|
||||||
|
mysql.connect_timeout = 60
|
||||||
|
|
||||||
|
; Trace mode. When trace_mode is active (=On), warnings for table/index scans and
|
||||||
|
; SQL-Errors will be displayed.
|
||||||
|
; http://php.net/mysql.trace-mode
|
||||||
|
mysql.trace_mode = Off
|
||||||
|
|
405
workspace/Dockerfile-56
Normal file
405
workspace/Dockerfile-56
Normal file
@ -0,0 +1,405 @@
|
|||||||
|
#
|
||||||
|
#--------------------------------------------------------------------------
|
||||||
|
# Image Setup
|
||||||
|
#--------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# To edit the 'workspace' base Image, visit its repository on Github
|
||||||
|
# https://github.com/LaraDock/workspace
|
||||||
|
#
|
||||||
|
# To change its version, see the available Tags on the Docker Hub:
|
||||||
|
# https://hub.docker.com/r/laradock/workspace/tags/
|
||||||
|
#
|
||||||
|
|
||||||
|
FROM laradock/workspace:1.3
|
||||||
|
|
||||||
|
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||||
|
|
||||||
|
#
|
||||||
|
#--------------------------------------------------------------------------
|
||||||
|
# Mandatory Software's Installation
|
||||||
|
#--------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Mandatory Software's such as ("php5.6-cli", "git", "vim", ....) are
|
||||||
|
# installed on the base image 'laradock/workspace' image. If you want
|
||||||
|
# to add more Software's or remove existing one, you need to edit the
|
||||||
|
# base image (https://github.com/LaraDock/workspace).
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
#--------------------------------------------------------------------------
|
||||||
|
# Optional Software's Installation
|
||||||
|
#--------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Optional Software's will only be installed if you set them to `true`
|
||||||
|
# in the `docker-compose.yml` before the build.
|
||||||
|
# Example:
|
||||||
|
# - INSTALL_NODE=false
|
||||||
|
# - ...
|
||||||
|
#
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# Non-Root User:
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
# Add a non-root user to prevent files being created with root permissions on host machine.
|
||||||
|
ARG PUID=1000
|
||||||
|
ARG PGID=1000
|
||||||
|
RUN groupadd -g $PGID laradock && \
|
||||||
|
useradd -u $PUID -g laradock -m laradock
|
||||||
|
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# SOAP:
|
||||||
|
#####################################
|
||||||
|
USER root
|
||||||
|
|
||||||
|
ARG INSTALL_SOAP=false
|
||||||
|
ENV INSTALL_SOAP ${INSTALL_SOAP}
|
||||||
|
|
||||||
|
RUN if [ ${INSTALL_SOAP} = true ]; then \
|
||||||
|
# Install the PHP SOAP extension
|
||||||
|
apt-get -y update && \
|
||||||
|
add-apt-repository -y ppa:ondrej/php && \
|
||||||
|
apt-get -y install libxml2-dev php5.6-soap && \
|
||||||
|
echo "extension=soap.so" >> /etc/php/5.6/cli/conf.d/40-soap.ini \
|
||||||
|
;fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# Set Timezone
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
ARG TZ=UTC
|
||||||
|
ENV TZ ${TZ}
|
||||||
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# Composer:
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
# Add the composer.json
|
||||||
|
COPY ./composer.json /home/laradock/.composer/composer.json
|
||||||
|
|
||||||
|
# Make sure that ~/.composer belongs to laradock
|
||||||
|
RUN chown -R laradock:laradock /home/laradock/.composer
|
||||||
|
USER laradock
|
||||||
|
|
||||||
|
# Check if global install need to be ran
|
||||||
|
ARG COMPOSER_GLOBAL_INSTALL=false
|
||||||
|
ENV COMPOSER_GLOBAL_INSTALL ${COMPOSER_GLOBAL_INSTALL}
|
||||||
|
RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \
|
||||||
|
# run the install
|
||||||
|
composer global install \
|
||||||
|
;fi
|
||||||
|
|
||||||
|
# Export composer vendor path
|
||||||
|
RUN echo "" >> ~/.bashrc && \
|
||||||
|
echo 'export PATH="~/.composer/vendor/bin:$PATH"' >> ~/.bashrc
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# Crontab
|
||||||
|
#####################################
|
||||||
|
USER root
|
||||||
|
|
||||||
|
COPY ./crontab /etc/cron.d
|
||||||
|
RUN chmod -R 644 /etc/cron.d
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# User Aliases
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
USER laradock
|
||||||
|
COPY ./aliases.sh /home/laradock/aliases.sh
|
||||||
|
RUN echo "" >> ~/.bashrc && \
|
||||||
|
echo "# Load Custom Aliases" >> ~/.bashrc && \
|
||||||
|
echo "source /home/laradock/aliases.sh" >> ~/.bashrc && \
|
||||||
|
echo "" >> ~/.bashrc
|
||||||
|
|
||||||
|
USER root
|
||||||
|
RUN echo "" >> ~/.bashrc && \
|
||||||
|
echo "# Load Custom Aliases" >> ~/.bashrc && \
|
||||||
|
echo "source /home/laradock/aliases.sh" >> ~/.bashrc && \
|
||||||
|
echo "" >> ~/.bashrc
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# xDebug:
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
ARG INSTALL_XDEBUG=false
|
||||||
|
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
|
||||||
|
# Load the xdebug extension only with phpunit commands
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install -y --force-yes php5.6-xdebug && \
|
||||||
|
sed -i 's/^/;/g' /etc/php/5.6/cli/conf.d/20-xdebug.ini && \
|
||||||
|
echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/vendor/bin/phpunit'" >> ~/.bashrc \
|
||||||
|
;fi
|
||||||
|
# ADD for REMOTE debugging
|
||||||
|
COPY ./xdebug.ini /etc/php/5.6/cli/conf.d/xdebug.ini
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# ssh:
|
||||||
|
#####################################
|
||||||
|
ARG INSTALL_WORKSPACE_SSH=false
|
||||||
|
ENV INSTALL_WORKSPACE_SSH ${INSTALL_WORKSPACE_SSH}
|
||||||
|
|
||||||
|
ADD insecure_id_rsa /tmp/id_rsa
|
||||||
|
ADD insecure_id_rsa.pub /tmp/id_rsa.pub
|
||||||
|
|
||||||
|
RUN if [ ${INSTALL_WORKSPACE_SSH} = true ]; then \
|
||||||
|
rm -f /etc/service/sshd/down && \
|
||||||
|
cat /tmp/id_rsa.pub >> /root/.ssh/authorized_keys \
|
||||||
|
&& cat /tmp/id_rsa.pub >> /root/.ssh/id_rsa.pub \
|
||||||
|
&& cat /tmp/id_rsa >> /root/.ssh/id_rsa \
|
||||||
|
&& rm -f /tmp/id_rsa* \
|
||||||
|
&& chmod 644 /root/.ssh/authorized_keys /root/.ssh/id_rsa.pub \
|
||||||
|
&& chmod 400 /root/.ssh/id_rsa \
|
||||||
|
;fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# MongoDB:
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
# Check if Mongo needs to be installed
|
||||||
|
ARG INSTALL_MONGO=false
|
||||||
|
ENV INSTALL_MONGO ${INSTALL_MONGO}
|
||||||
|
RUN if [ ${INSTALL_MONGO} = true ]; then \
|
||||||
|
# Install the mongodb extension
|
||||||
|
pecl install mongodb && \
|
||||||
|
echo "extension=mongodb.so" >> /etc/php/5.6/cli/conf.d/30-mongodb.ini \
|
||||||
|
;fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# Drush:
|
||||||
|
#####################################
|
||||||
|
USER root
|
||||||
|
ENV DRUSH_VERSION 8.1.2
|
||||||
|
ARG INSTALL_DRUSH=false
|
||||||
|
ENV INSTALL_DRUSH ${INSTALL_DRUSH}
|
||||||
|
RUN if [ ${INSTALL_DRUSH} = true ]; then \
|
||||||
|
# Install Drush 8 with the phar file.
|
||||||
|
curl -fsSL -o /usr/local/bin/drush https://github.com/drush-ops/drush/releases/download/$DRUSH_VERSION/drush.phar | bash && \
|
||||||
|
chmod +x /usr/local/bin/drush && \
|
||||||
|
drush core-status \
|
||||||
|
;fi
|
||||||
|
|
||||||
|
USER laradock
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# Node / NVM:
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
# Check if NVM needs to be installed
|
||||||
|
ARG NODE_VERSION=stable
|
||||||
|
ENV NODE_VERSION ${NODE_VERSION}
|
||||||
|
ARG INSTALL_NODE=false
|
||||||
|
ENV INSTALL_NODE ${INSTALL_NODE}
|
||||||
|
ENV NVM_DIR /home/laradock/.nvm
|
||||||
|
RUN if [ ${INSTALL_NODE} = true ]; then \
|
||||||
|
# Install nvm (A Node Version Manager)
|
||||||
|
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash && \
|
||||||
|
. $NVM_DIR/nvm.sh && \
|
||||||
|
nvm install ${NODE_VERSION} && \
|
||||||
|
nvm use ${NODE_VERSION} && \
|
||||||
|
nvm alias ${NODE_VERSION} && \
|
||||||
|
npm install -g gulp bower vue-cli \
|
||||||
|
;fi
|
||||||
|
|
||||||
|
# Wouldn't execute when added to the RUN statement in the above block
|
||||||
|
# Source NVM when loading bash since ~/.profile isn't loaded on non-login shell
|
||||||
|
RUN if [ ${INSTALL_NODE} = true ]; then \
|
||||||
|
echo "" >> ~/.bashrc && \
|
||||||
|
echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.bashrc && \
|
||||||
|
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \
|
||||||
|
;fi
|
||||||
|
|
||||||
|
# Add NVM binaries to root's .bashrc
|
||||||
|
USER root
|
||||||
|
|
||||||
|
RUN if [ ${INSTALL_NODE} = true ]; then \
|
||||||
|
echo "" >> ~/.bashrc && \
|
||||||
|
echo 'export NVM_DIR="/home/laradock/.nvm"' >> ~/.bashrc && \
|
||||||
|
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \
|
||||||
|
;fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# YARN:
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
USER laradock
|
||||||
|
|
||||||
|
ARG INSTALL_YARN=false
|
||||||
|
ENV INSTALL_YARN ${INSTALL_YARN}
|
||||||
|
ARG YARN_VERSION=latest
|
||||||
|
ENV YARN_VERSION ${YARN_VERSION}
|
||||||
|
|
||||||
|
RUN if [ ${INSTALL_YARN} = true ]; then \
|
||||||
|
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" && \
|
||||||
|
if [ ${YARN_VERSION} = "latest" ]; then \
|
||||||
|
curl -o- -L https://yarnpkg.com/install.sh | bash; \
|
||||||
|
else \
|
||||||
|
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version ${YARN_VERSION}; \
|
||||||
|
fi && \
|
||||||
|
echo "" >> ~/.bashrc && \
|
||||||
|
echo 'export PATH="$HOME/.yarn/bin:$PATH"' >> ~/.bashrc \
|
||||||
|
;fi
|
||||||
|
|
||||||
|
# Add YARN binaries to root's .bashrc
|
||||||
|
USER root
|
||||||
|
|
||||||
|
RUN if [ ${INSTALL_YARN} = true ]; then \
|
||||||
|
echo "" >> ~/.bashrc && \
|
||||||
|
echo 'export YARN_DIR="/home/laradock/.yarn"' >> ~/.bashrc && \
|
||||||
|
echo 'export PATH="$YARN_DIR/bin:$PATH"' >> ~/.bashrc \
|
||||||
|
;fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# PHP Aerospike:
|
||||||
|
#####################################
|
||||||
|
USER root
|
||||||
|
|
||||||
|
ARG INSTALL_AEROSPIKE_EXTENSION=true
|
||||||
|
ENV INSTALL_AEROSPIKE_EXTENSION ${INSTALL_AEROSPIKE_EXTENSION}
|
||||||
|
|
||||||
|
# Copy aerospike configration for remote debugging
|
||||||
|
COPY ./aerospike.ini /etc/php/5.6/cli/conf.d/aerospike.ini
|
||||||
|
|
||||||
|
RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = true ]; then \
|
||||||
|
# Install the php aerospike extension
|
||||||
|
curl -L -o /tmp/aerospike-client-php.tar.gz "https://github.com/luciano-jr/aerospike-client-php/archive/master.tar.gz" \
|
||||||
|
&& mkdir -p aerospike-client-php \
|
||||||
|
&& tar -C aerospike-client-php -zxvf /tmp/aerospike-client-php.tar.gz --strip 1 \
|
||||||
|
&& ( \
|
||||||
|
cd aerospike-client-php/src/aerospike \
|
||||||
|
&& phpize \
|
||||||
|
&& ./build.sh \
|
||||||
|
&& make install \
|
||||||
|
) \
|
||||||
|
&& rm /tmp/aerospike-client-php.tar.gz \
|
||||||
|
;fi
|
||||||
|
|
||||||
|
RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = false ]; then \
|
||||||
|
rm /etc/php/5.6/cli/conf.d/aerospike.ini \
|
||||||
|
;fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# PHP V8JS:
|
||||||
|
#####################################
|
||||||
|
USER root
|
||||||
|
|
||||||
|
ARG INSTALL_V8JS_EXTENSION=false
|
||||||
|
ENV INSTALL_V8JS_EXTENSION ${INSTALL_V8JS_EXTENSION}
|
||||||
|
|
||||||
|
RUN if [ ${INSTALL_V8JS_EXTENSION} = true ]; then \
|
||||||
|
# Install the php V8JS extension
|
||||||
|
add-apt-repository -y ppa:pinepain/libv8-5.4 \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y php-dev php-pear libv8-5.4 \
|
||||||
|
&& pecl install v8js \
|
||||||
|
&& echo "extension=v8js.so" >> /etc/php/5.6/cli/php.ini \
|
||||||
|
;fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# Non-root user : PHPUnit path
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
# add ./vendor/bin to non-root user's bashrc (needed for phpunit)
|
||||||
|
USER laradock
|
||||||
|
|
||||||
|
RUN echo "" >> ~/.bashrc && \
|
||||||
|
echo 'export PATH="/var/www/vendor/bin:$PATH"' >> ~/.bashrc
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# Laravel Artisan Alias
|
||||||
|
#####################################
|
||||||
|
USER root
|
||||||
|
|
||||||
|
RUN echo "" >> ~/.bashrc && \
|
||||||
|
echo 'alias art="php artisan"' >> ~/.bashrc
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# Laravel Envoy:
|
||||||
|
#####################################
|
||||||
|
USER laradock
|
||||||
|
|
||||||
|
ARG INSTALL_LARAVEL_ENVOY=true
|
||||||
|
ENV INSTALL_LARAVEL_ENVOY ${INSTALL_LARAVEL_ENVOY}
|
||||||
|
|
||||||
|
RUN if [ ${INSTALL_LARAVEL_ENVOY} = true ]; then \
|
||||||
|
# Install the Laravel Envoy
|
||||||
|
composer global require "laravel/envoy=~1.0" \
|
||||||
|
;fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# Deployer:
|
||||||
|
#####################################
|
||||||
|
USER laradock
|
||||||
|
|
||||||
|
ARG INSTALL_DEPLOYER=false
|
||||||
|
ENV INSTALL_DEPLOYER ${INSTALL_DEPLOYER}
|
||||||
|
|
||||||
|
RUN if [ ${INSTALL_DEPLOYER} = true ]; then \
|
||||||
|
# Install the Deployer
|
||||||
|
composer global require "deployer/deployer" \
|
||||||
|
;fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# Linuxbrew:
|
||||||
|
#####################################
|
||||||
|
USER root
|
||||||
|
|
||||||
|
ARG INSTALL_LINUXBREW=true
|
||||||
|
ENV INSTALL_LINUXBREW ${INSTALL_LINUXBREW}
|
||||||
|
|
||||||
|
RUN if [ ${INSTALL_LINUXBREW} = true ]; then \
|
||||||
|
|
||||||
|
# Preparation
|
||||||
|
apt-get update && \
|
||||||
|
apt-get upgrade -y && \
|
||||||
|
apt-get install -y build-essential make cmake scons curl git \
|
||||||
|
ruby autoconf automake autoconf-archive \
|
||||||
|
gettext libtool flex bison \
|
||||||
|
libbz2-dev libcurl4-openssl-dev \
|
||||||
|
libexpat-dev libncurses-dev && \
|
||||||
|
|
||||||
|
# Install the Linuxbrew
|
||||||
|
git clone https://github.com/Homebrew/linuxbrew.git ~/.linuxbrew && \
|
||||||
|
|
||||||
|
echo "" >> ~/.bashrc && \
|
||||||
|
echo 'export PKG_CONFIG_PATH"=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib64/pkgconfig:/usr/share/pkgconfig:$PKG_CONFIG_PATH"' >> ~/.bashrc && \
|
||||||
|
|
||||||
|
# Setup linuxbrew
|
||||||
|
echo 'export LINUXBREWHOME="$HOME/.linuxbrew"' >> ~/.bashrc && \
|
||||||
|
echo 'export PATH="$LINUXBREWHOME/bin:$PATH"' >> ~/.bashrc && \
|
||||||
|
echo 'export MANPATH="$LINUXBREWHOME/man:$MANPATH"' >> ~/.bashrc && \
|
||||||
|
echo 'export PKG_CONFIG_PATH="$LINUXBREWHOME/lib64/pkgconfig:$LINUXBREWHOME/lib/pkgconfig:$PKG_CONFIG_PATH"' >> ~/.bashrc && \
|
||||||
|
echo 'export LD_LIBRARY_PATH="$LINUXBREWHOME/lib64:$LINUXBREWHOME/lib:$LD_LIBRARY_PATH"' >> ~/.bashrc \
|
||||||
|
;fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# Minio:
|
||||||
|
#####################################
|
||||||
|
USER root
|
||||||
|
ARG INSTALL_MC=false
|
||||||
|
ENV INSTALL_MC ${INSTALL_MC}
|
||||||
|
|
||||||
|
COPY mc/config.json /root/.mc/config.json
|
||||||
|
|
||||||
|
RUN if [ ${INSTALL_MC} = true ]; then\
|
||||||
|
curl -fsSL -o /usr/local/bin/mc https://dl.minio.io/client/mc/release/linux-amd64/mc && \
|
||||||
|
chmod +x /usr/local/bin/mc \
|
||||||
|
;fi
|
||||||
|
|
||||||
|
USER laradock
|
||||||
|
|
||||||
|
#
|
||||||
|
#--------------------------------------------------------------------------
|
||||||
|
# Final Touch
|
||||||
|
#--------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
USER root
|
||||||
|
RUN apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
|
# Set default work directory
|
||||||
|
WORKDIR /var/www
|
Reference in New Issue
Block a user