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

@ -2,7 +2,7 @@
This document describes how to contribute an app to CasaOS AppStore. This document describes how to contribute an app to CasaOS AppStore.
## Submit Process ## Submit Process
App submission should be done via Pull Request. Fork this repository and prepare the app per guidelines below. App submission should be done via Pull Request. Fork this repository and prepare the app per guidelines below.
@ -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`.
@ -132,59 +134,56 @@ Each directory under [Apps](Apps) correspond to a CasaOS App. The directory shou
``` ```
3. Magic Value 3. Magic Value
**Note**: The features is only working in casaos 0.4.4 and newer version. **Note**: The features is only working in casaos 0.4.4 and newer version.
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
- $WEBUI_PORT
##### Environment variable - 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:
```yaml ```yaml
... ...
ports: ports:
- target: 5230 - target: 5230
published: ${WEBUI_PORT} published: ${WEBUI_PORT}
protocol: tcp protocol: tcp
... ...
x-casaos: x-casaos:
architectures: architectures:
- amd64 - amd64
- arm64 - arm64
- arm - arm
... ...
port_map: ${WEBUI_PORT} port_map: ${WEBUI_PORT}
``` ```
or
```yaml or
...
ports: ```yaml
- target: 5230 ...
published: ${WEBUI_PORT:-5230} ports:
protocol: tcp - target: 5230
... published: ${WEBUI_PORT:-5230}
x-casaos: protocol: tcp
architectures: ...
- amd64 x-casaos:
- arm64 architectures:
- arm - amd64
... - arm64
port_map: ${WEBUI_PORT:-5230} - arm
``` ...
port_map: ${WEBUI_PORT:-5230}
**Note**: the WEBUI_PORT only allocated once. It promise the port is available when allocated. If the port be used by other application. It didn't reallocate a new port. ```
**Note**: the WEBUI_PORT only allocated once. It promise the port is available when allocated. If the port be used by other application. It didn't reallocate a new port.
## Requirements for Featured Apps ## Requirements for Featured Apps