Skip to content

Commit 7bfb9df

Browse files
author
Nemanja Ognjanovic
committed
improved app's docker usability
1 parent 962ab48 commit 7bfb9df

File tree

6 files changed

+48
-23
lines changed

6 files changed

+48
-23
lines changed

README.md

+20-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
[![Coverage Status](https://coveralls.io/repos/github/phpsrbija/unfinished/badge.svg)](https://coveralls.io/github/phpsrbija/unfinished)
55
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/phpsrbija/unfinished/badges/quality-score.png?s=4023c984fc1163a44f4220cd7d57406643ced9f2)](https://scrutinizer-ci.com/g/phpsrbija/unfinished/)
66

7-
## Instalation
7+
## Installation
8+
9+
### Vagrant (Recommended)
810

911
```
1012
git clone https://github.com/phpsrbija/unfinished.git
@@ -21,6 +23,23 @@ Admin is at http://unfinished.test/admin
2123
2224
pass: testtest
2325

26+
### Docker
27+
28+
```
29+
git clone https://github.com/phpsrbija/unfinished.git
30+
cd unfinished
31+
docker-compose up
32+
docker-compose run php composer install
33+
docker-compose run php bin/setup-db.sh docker
34+
35+
```
36+
37+
Open in your browser http://localhost and voila!
38+
39+
Admin is at http://localhost/admin
40+
41+
pass: testtest
42+
2443
## Our main philosophy of software architecture
2544

2645
Packages, packages and packages...

application/bin/setup-db.sh

+11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
#!/usr/bin/env bash
2+
MODE=$1;
3+
if [ "$MODE" != "docker" ]; then
4+
MODE="vagrant"
5+
fi
26

37
echo "
48
────────────────────────────────────────────────────────────────────────────────────────────────────────
@@ -11,6 +15,13 @@ fi
1115
if [ ! -f /var/www/unfinished/config/autoload/local.php ]; then
1216
cp /var/www/unfinished/config/autoload/local.php.dist /var/www/unfinished/config/autoload/local.php
1317
fi
18+
if [ "$MODE" = "docker" ]; then
19+
sed -i -e 's/localhost/mysql/g' /var/www/unfinished/data/phinx/phinx.php
20+
sed -i -e 's/root/unfinished/g' /var/www/unfinished/data/phinx/phinx.php
21+
22+
sed -i -e 's/host=localhost/host=mysql/g' /var/www/unfinished/config/autoload/local.php
23+
sed -i -e "s/'username' => 'root'/'username' => 'unfinished'/g" /var/www/unfinished/config/autoload/local.php
24+
fi
1425

1526
echo "
1627
────────────────────────────────────────────────────────────────────────────────────────────────────────

docker-compose.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,23 @@ services:
77
volumes_from:
88
- app
99
php:
10-
#restart: always
11-
build: ./docker/php7.0-fpm/
12-
##build: .
13-
#restart: always
14-
#image: phpdockerio/php7-fpm
10+
build:
11+
context: ./docker/php7.0-fpm
12+
dockerfile: ./Dockerfile
1513
expose:
1614
- 9000
1715
volumes_from:
1816
- app
17+
tty: true
18+
working_dir: /var/www/unfinished
1919
app:
20-
image: phpdockerio/php7-fpm
20+
build:
21+
context: ./docker/app
22+
dockerfile: ./Dockerfile
2123
volumes:
2224
- ./application:/var/www/unfinished
2325
command: "true"
2426
mysql:
25-
# build: ./mysql/
2627
image: mysql:latest
2728
volumes_from:
2829
- data
@@ -47,4 +48,3 @@ services:
4748
image: redis
4849
expose:
4950
- 6379
50-
#command: "start"

docker/app/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM phpdockerio/php7-fpm

docker/mysql/Dockerfile

-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
11
FROM mysql:latest
22
COPY ./mysqld.cnf /etc/mysql/mysql.conf.d/mysqld.cnf
3-
4-
# add to your machine
5-
#RUN mysql -u root -psecret -e 'create database pulsonlinepulsar_testing;'
6-
#RUN cat /etc/mysql/mysql.conf.d/mysqld.cnf

docker/php7.0-fpm/Dockerfile

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
FROM phpdockerio/php7-fpm
2-
#COPY ./www.conf /etc/php5/fpm/pool.d/www.conf
32

4-
WORKDIR /var/www/unfinished
3+
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
54

65
# Install dependencies
7-
RUN apt-get update && \
8-
apt-get -y install curl \
6+
RUN apt-get update \
7+
&& \
8+
apt-get install -y -o Dpkg::Options::=--force-confdef \
99
vim \
10-
php7.0-xdebug \
1110
php7.0-mysql \
12-
php7.0-mbstring && \
11+
php7.0-xdebug \
12+
php7.0-mbstring \
13+
&& \
1314
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
1415

15-
16-
RUN sed -i 's/;daemonize = yes/daemonize = no/g' /etc/php/7.0/fpm/php-fpm.conf
17-
18-
#CMD ["/usr/sbin/php7.0-fpm"]
16+
RUN sed -i 's/;daemonize = yes/daemonize = no/g' /etc/php/7.0/fpm/php-fpm.conf

0 commit comments

Comments
 (0)