Skip to content

Commit 3f159a8

Browse files
feat: Docker compose (#101)
1 parent 34366b7 commit 3f159a8

File tree

3 files changed

+48
-5
lines changed

3 files changed

+48
-5
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
**
2+
!app/
3+
!bin/
4+
!config/
5+
!composer.*

README.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,36 @@ The easiest way to create a new Hyperf project is to use [Composer](https://getc
2828
To create your new Hyperf project:
2929

3030
```bash
31-
$ composer create-project hyperf/hyperf-skeleton path/to/install
31+
composer create-project hyperf/hyperf-skeleton path/to/install
3232
```
3333

34+
If your development environment is based on Docker you can use the official Composer image to create a new Hyperf project:
35+
36+
```bash
37+
docker run --rm -it -v $(pwd):/app composer create-project --ignore-platform-reqs hyperf/hyperf-skeleton path/to/install
38+
```
39+
40+
# Getting started
41+
3442
Once installed, you can run the server immediately using the command below.
3543

3644
```bash
37-
$ cd path/to/install
38-
$ php bin/hyperf.php start
45+
cd path/to/install
46+
php bin/hyperf.php start
3947
```
4048

41-
This will start the cli-server on port `9501`, and bind it to all network interfaces. You can then visit the site at `http://localhost:9501/`
49+
Or if in a Docker based environment you can use the `docker-compose.yml` provided by the template:
50+
51+
```bash
52+
cd path/to/install
53+
docker-compose up
54+
```
55+
56+
This will start the cli-server on port `9501`, and bind it to all network interfaces. You can then visit the site at `http://localhost:9501/` which will bring up Hyperf default home page.
57+
58+
## Hints
59+
60+
- A nice tip is to rename `hyperf-skeleton` of files like `composer.json` and `docker-compose.yml` to your actual project name.
61+
- Take a look at `config/routes.php` and `app/Controller/IndexController.php` to see an example of a HTTP entrypoint.
4262

43-
which will bring up Hyperf default home page.
63+
**Remember:** you can always replace the contents of this README.md file to something that fits your project description.

docker-compose.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: '3'
2+
services:
3+
hyperf-skeleton:
4+
container_name: hyperf-skeleton
5+
image: hyperf-skeleton
6+
build:
7+
context: .
8+
volumes:
9+
- ./:/opt/www
10+
ports:
11+
- 9501:9501
12+
environment:
13+
- APP_ENV=dev
14+
- SCAN_CACHEABLE=false
15+
16+
networks:
17+
default:
18+
name: hyperf-skeleton

0 commit comments

Comments
 (0)