Skip to content

Commit

Permalink
feat: Docker compose (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
leocavalcante authored Sep 13, 2023
1 parent 34366b7 commit 3f159a8
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**
!app/
!bin/
!config/
!composer.*
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,36 @@ The easiest way to create a new Hyperf project is to use [Composer](https://getc
To create your new Hyperf project:

```bash
$ composer create-project hyperf/hyperf-skeleton path/to/install
composer create-project hyperf/hyperf-skeleton path/to/install
```

If your development environment is based on Docker you can use the official Composer image to create a new Hyperf project:

```bash
docker run --rm -it -v $(pwd):/app composer create-project --ignore-platform-reqs hyperf/hyperf-skeleton path/to/install
```

# Getting started

Once installed, you can run the server immediately using the command below.

```bash
$ cd path/to/install
$ php bin/hyperf.php start
cd path/to/install
php bin/hyperf.php start
```

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/`
Or if in a Docker based environment you can use the `docker-compose.yml` provided by the template:

```bash
cd path/to/install
docker-compose up
```

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.

## Hints

- A nice tip is to rename `hyperf-skeleton` of files like `composer.json` and `docker-compose.yml` to your actual project name.
- Take a look at `config/routes.php` and `app/Controller/IndexController.php` to see an example of a HTTP entrypoint.

which will bring up Hyperf default home page.
**Remember:** you can always replace the contents of this README.md file to something that fits your project description.
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: '3'
services:
hyperf-skeleton:
container_name: hyperf-skeleton
image: hyperf-skeleton
build:
context: .
volumes:
- ./:/opt/www
ports:
- 9501:9501
environment:
- APP_ENV=dev
- SCAN_CACHEABLE=false

networks:
default:
name: hyperf-skeleton

0 comments on commit 3f159a8

Please sign in to comment.