File tree Expand file tree Collapse file tree 6 files changed +31
-8
lines changed Expand file tree Collapse file tree 6 files changed +31
-8
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ bash: cli
4545cli :
4646 $(DOCKER ) bash
4747
48- start-docker : config/components-dev.local.php config/components-test.local.php backend/config/cookie-validation.key env.php stop
48+ start-docker : runtime/build-docker config/components-dev.local.php config/components-test.local.php backend/config/cookie-validation.key env.php stop
4949 docker-compose up -d
5050 docker-compose exec -T backend-php bash -c " grep '^$( shell whoami) :' /etc/passwd || useradd -m '$( shell whoami) ' --uid=$( shell id -u) -G www-data -s /bin/bash"
5151 docker-compose exec -T backend-php bash -c " sed -i 's/#force_color_prompt=yes/force_color_prompt=yes/' /home/$( shell whoami) /.bashrc && sed -i 's~etc/bash_completion~etc/bash_completion.d/yii~' /home/$( shell whoami) /.bashrc"
@@ -60,6 +60,10 @@ start-docker: config/components-dev.local.php config/components-test.local.php b
6060stop-docker :
6161 docker-compose down
6262
63+ runtime/build-docker : * /Dockerfile
64+ docker-compose build
65+ touch $@
66+
6367# copy config files if they do not exist
6468config/components-% .local.php : config/components-ENV.local.php
6569 test -f $@ || cp $< $@
Original file line number Diff line number Diff line change @@ -62,6 +62,11 @@ You can now continue with [generating code](#generate-code).
6262### Using Docker
6363
6464You need [ Docker] ( https://docs.docker.com/install/ ) and [ Docker Compose] ( https://docs.docker.com/compose/install/ ) installed.
65+
66+ Create the repository:
67+
68+ composer create-project cebe/yii2-app-api my-api
69+
6570For the easiest way you need GNU make, then run:
6671
6772 make start-docker
Original file line number Diff line number Diff line change 11FROM yiisoftware/yii2-php:7.4-apache
22
3+ # install git and unzip for composer install dist/source
4+ RUN apt-get update && apt-get -y install git unzip && apt-get clean && rm -rf /var/lib/apt/lists/*
5+
36COPY config/apache.conf /etc/apache2/sites-enabled/000-default.conf
Original file line number Diff line number Diff line change 11FROM yiisoftware/yii2-php:7.4-apache
22
3+ # install git and unzip for composer install dist/source
4+ RUN apt-get update && apt-get -y install git unzip && apt-get clean && rm -rf /var/lib/apt/lists/*
5+
36COPY config/apache.conf /etc/apache2/sites-enabled/000-default.conf
Original file line number Diff line number Diff line change 77 "php" : " >=7.1.0" ,
88 "yiisoft/yii2" : " ~2.0.16" ,
99 "cebe/php-openapi" : " ^1.1" ,
10- "cebe/yii2-openapi" : " ^2.0@alpha " ,
10+ "cebe/yii2-openapi" : " ^2.0@beta " ,
1111 "yiisoft/yii2-gii" : " ^2.1"
1212 },
1313 "autoload" : {
Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ services:
1111 volumes :
1212 # Mount source-code for development
1313 - ./:/app
14+ depends_on :
15+ - db
16+ - redis
17+ - mailcatcher
1418
1519 backend-php :
1620 build : backend
@@ -21,19 +25,23 @@ services:
2125 - ~/.composer-docker/cache:/root/.composer/cache:delegated
2226 # Mount source-code for development
2327 - ./:/app
28+ depends_on :
29+ - db
30+ - redis
31+ - mailcatcher
2432
2533 db :
26- image : mysql:5.7
34+ image : mariadb:10.8
2735 environment :
28- # - MYSQL_ROOT_PASSWORD =verysecret
29- - MYSQL_DATABASE =api_db
30- - MYSQL_USER =api
31- - MYSQL_PASSWORD =apisecret
36+ - MARIADB_ROOT_PASSWORD =verysecret
37+ - MARIADB_DATABASE =api_db
38+ - MARIADB_USER =api
39+ - MARIADB_PASSWORD =apisecret
3240
3341 redis :
3442 image : redis:3
3543
3644 mailcatcher :
3745 image : nisenabe/mailcatcher
3846 ports :
39- - ' 80 '
47+ - ' 8055:1080 '
You can’t perform that action at this time.
0 commit comments