Skip to content

Commit

Permalink
📝 Add docs for custom PRE_START_PATH env var (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiangolo authored Apr 6, 2020
1 parent 1b09d2b commit e36627c
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/tiangolo/uvicorn-gunicorn-starlette-docker.svg?branch=master)](https://travis-ci.org/tiangolo/uvicorn-gunicorn-starlette-docker)
[![Build Status](https://travis-ci.com/tiangolo/uvicorn-gunicorn-starlette-docker.svg?branch=master)](https://travis-ci.com/tiangolo/uvicorn-gunicorn-starlette-docker)

## Supported tags and respective `Dockerfile` links

Expand Down Expand Up @@ -343,6 +343,18 @@ You can set it like:
docker run -d -p 80:8080 -e LOG_LEVEL="warning" myimage
```

#### `PRE_START_PATH`

The path where to find the pre-start script.

By default, set to `/app/prestart.sh`.

You can set it like:

```bash
docker run -d -p 80:8080 -e PRE_START_PATH="/custom/script.sh" myimage
```

### Custom Gunicorn configuration file

The image includes a default Gunicorn Python config file at `/gunicorn_conf.py`.
Expand All @@ -357,7 +369,7 @@ You can override it by including a file in:

### Custom `/app/prestart.sh`

If you need to run anything before starting the app, you can add a file `prestart.sh` to the directory `/app`. The image will automatically detect and run it before starting everything.
If you need to run anything before starting the app, you can add a file `prestart.sh` to the directory `/app`. The image will automatically detect and run it before starting everything.

For example, if you want to add Alembic SQL migrations (with SQLALchemy), you could create a `./app/prestart.sh` file in your code directory (that will be copied by your `Dockerfile`) with:

Expand All @@ -381,6 +393,8 @@ If you need to run a Python script before starting the app, you could make the `
python /app/my_custom_prestart_script.py
```

You can customize the location of the prestart script with the environment variable `PRE_START_PATH` described above.

### Development live reload

The default program that is run is at `/start.sh`. It does everything described above.
Expand Down

0 comments on commit e36627c

Please sign in to comment.