update CONTRIBUTING.md with a requirement for Docker Compose `name` property (#235)

This commit is contained in:
Tiger Wang 2023-08-04 10:55:55 +08:00 committed by GitHub
parent 9a7e09b023
commit 9275a66646
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 47 deletions

View File

@ -1,4 +1,4 @@
name: MongoDB name: mongodb
services: services:
mongo: mongo:
image: mongo:6.0.6 image: mongo:6.0.6

View File

@ -39,7 +39,9 @@ App-Name
Each directory under [Apps](Apps) correspond to a CasaOS App. The directory should contain at least a `docker-compose.yml` file: Each directory under [Apps](Apps) correspond to a CasaOS App. The directory should contain at least a `docker-compose.yml` file:
- It should be a valid [Docker Compose file](https://docs.docker.com/compose/compose-file/). - It should be a valid [Docker Compose file](https://docs.docker.com/compose/compose-file/). Here are some requirements (but not limited to):
- `name` must contain only lower case letters, numbers, underscore "`_`" and hyphen "`-`" (in other words, must match `^[a-z0-9][a-z0-9_-]*$`)
- Image tag should be specific, e.g. `:0.1.2`, instead of `:latest`. - Image tag should be specific, e.g. `:0.1.2`, instead of `:latest`.
@ -137,18 +139,13 @@ Each directory under [Apps](Apps) correspond to a CasaOS App. The directory shou
For resolves some cases. Casaos provide some magic value to power your application: For resolves some cases. Casaos provide some magic value to power your application:
- Any environment variable that user to set - Environment variable
- $WEBUI_PORT
##### Environment variable
> for developer
your application can read environment variable that user set, such as `OPENAI_API_KEY` from environment variable. It is store in `/etc/casaos/env`. User can set only once and using anywhere. It can be change by api, after change, all application will re up to inject new env var. your application can read environment variable that user set, such as `OPENAI_API_KEY` from environment variable. It is store in `/etc/casaos/env`. User can set only once and using anywhere. It can be change by api, after change, all application will re up to inject new env var.
**Note**: change the config didn't change the env var of current container. To set env var, you should use cli to set it. **Note**: change the config didn't change the env var of current container. To set env var, you should use cli to set it.
#### WEBUI_PORT - `WEBUI_PORT`
> for application maintainer
your `docker-compose.yml` can use `WEBUI_PORT` to set webui port. Casaos will assign a available port for your application. You can use it like this: your `docker-compose.yml` can use `WEBUI_PORT` to set webui port. Casaos will assign a available port for your application. You can use it like this:
@ -167,7 +164,9 @@ Each directory under [Apps](Apps) correspond to a CasaOS App. The directory shou
... ...
port_map: ${WEBUI_PORT} port_map: ${WEBUI_PORT}
``` ```
or or
```yaml ```yaml
... ...
ports: ports: