chore(build): add a PORTAINER_FLAGS env var for yarn so I can default a password, and enable feature flags (#6116)

Signed-off-by: Sven Dowideit <sven.dowideit@portainer.io>
pull/6150/head
Sven Dowideit 2021-11-24 12:45:42 +10:00 committed by GitHub
parent 761d2a11d3
commit 2555dfc78b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -75,7 +75,7 @@ The feature request process is similar to the bug report process but has an extr
![portainer_featurerequest_workflow](https://user-images.githubusercontent.com/5485061/45727229-5ad39f00-bbf5-11e8-9550-16ba66c50615.png) ![portainer_featurerequest_workflow](https://user-images.githubusercontent.com/5485061/45727229-5ad39f00-bbf5-11e8-9550-16ba66c50615.png)
## Build Portainer locally ## Build and run Portainer locally
Ensure you have Docker, Node.js, yarn, and Golang installed in the correct versions. Ensure you have Docker, Node.js, yarn, and Golang installed in the correct versions.
@ -85,7 +85,7 @@ Install dependencies with yarn:
$ yarn $ yarn
``` ```
Then build and run the project: Then build and run the project in a Docker container:
```sh ```sh
$ yarn start $ yarn start
@ -95,6 +95,14 @@ Portainer can now be accessed at <https://localhost:9443>.
Find more detailed steps at <https://documentation.portainer.io/contributing/instructions/>. Find more detailed steps at <https://documentation.portainer.io/contributing/instructions/>.
### Build customisation
You can customise the following settings:
- `PORTAINER_DATA`: The host dir or volume name used by portainer (default is `/tmp/portainer`, which won't persist over reboots).
- `PORTAINER_PROJECT`: The root dir of the repository - `${portainerRoot}/dist/` is imported into the container to get the build artifacts and external tools (defaults to `your current dir`).
- `PORTAINER_FLAGS`: a list of flags to be used on the portainer commandline, in the form `--admin-password=<pwd hash> --feat fdo=false --feat open-amt` (default: `""`).
## Adding api docs ## Adding api docs
When adding a new resource (or a route handler), we should add a new tag to api/http/handler/handler.go#L136 like this: When adding a new resource (or a route handler), we should add a new tag to api/http/handler/handler.go#L136 like this:

View File

@ -158,6 +158,7 @@ function shell_build_binary_azuredevops(platform, arch) {
function shell_run_container() { function shell_run_container() {
const portainerData = '${PORTAINER_DATA:-/tmp/portainer}'; const portainerData = '${PORTAINER_DATA:-/tmp/portainer}';
const portainerRoot = process.env.PORTAINER_PROJECT ? process.env.PORTAINER_PROJECT : process.env.PWD; const portainerRoot = process.env.PORTAINER_PROJECT ? process.env.PORTAINER_PROJECT : process.env.PWD;
const portainerFlags = '${PORTAINER_FLAGS:-}';
return ` return `
docker rm -f portainer docker rm -f portainer
@ -172,7 +173,7 @@ function shell_run_container() {
-v /tmp:/tmp \ -v /tmp:/tmp \
--name portainer \ --name portainer \
portainer/base \ portainer/base \
/app/portainer /app/portainer ${portainerFlags}
`; `;
} }