vmware-labs / wasm-workers-server

🚀 Develop and run serverless applications on WebAssembly

Home Page:https://workers.wasmlabs.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simplify how you run wws commands in the container

Angelmmiguel opened this issue · comments

Is your feature request related to a problem? Please describe.

The wws container runs the wws CLI with a set of default flags. To configure this behavior, the container uses the CMD directive:

CMD ["/wws", "/app/", "--host", "0.0.0.0"]

This solution works well when you don't want to modify or add argument. However, if you want to add a flag or run a project from a remote repository, the following command doesn't work:

docker run -p 8080:8080 ghcr.io/vmware-labs/wws:v1.3.0 \
  https://github.com/vmware-labs/wasm-workers-server.git \
    --git-folder "examples/js-basic" \
    -i --enable-panel --host 0.0.0.0

The CMD directive gets fully override and it fails because "https://github.com/vmware-labs/wasm-workers-server.git" is not a valid binary. You need to refer to the wws binary directly, which it's not in the PATH making difficult to add / remove parameters.

The following code works, but it's not trivial:

docker run -p 8080:8080 ghcr.io/vmware-labs/wws:v1.3.0 \
  /wws https://github.com/vmware-labs/wasm-workers-server.git \
    --git-folder "examples/js-basic" \
    -i --enable-panel --host 0.0.0.0

Describe the solution you'd like

I want the container to run "like a binary". The following command should work out of the box:

docker run -p 8080:8080 ghcr.io/vmware-labs/wws:v1.3.0 \
  https://github.com/vmware-labs/wasm-workers-server.git \
    --git-folder "examples/js-basic" \
    -i --enable-panel --host 0.0.0.0

These are the requirements:

  • The container always run the wws CLI. For that, we can use the ENTRYPOINT directive which fits perfectly for this use case.
  • Keep the CMD directive, but only for the default arguments (/app and --host 0.0.0.0). You can override the default values by adding arguments as showed in the previous example. There is a great example in the Docker documentation.

For convenience, the wws should be present in the PATH in case you need to update the default entrypoint. Pointing it to the binary location (/wws) is not trivial.

Describe alternatives you've considered

No response

Additional context

No response

I want to try to solve this problem.

Hello @dierbei,

That would be amazing! I assigned the issue to you. Feel free to drop any question or comment here 😄