vi / websocat

Command-line client for WebSockets, like netcat (or curl) for ws:// with advanced socat-like functions
MIT License
6.72k stars 257 forks source link

Hope to provide the official docker image #154

Closed Dreamacro closed 3 months ago

Dreamacro commented 2 years ago

I've searched from https://hub.docker.com/search?q=websocat, but can't find an official docker image.

It would be helpful to have a github packages or dockerhub image to use this tool.

vi commented 2 years ago

I remember somebody contributing a Dockerfile for Websocat. Does it still work? (I don't use it myself).

Dreamacro commented 2 years ago

It broken but I can create a pull request to fixed it. If the build works, is it possible to add a github action to automatically generate an official docker image?

vi commented 2 years ago

Websocat does not currently use a CI (there was previously a travis-ci.org for checking commits, but now it is defunct). I typically build release artifacts on my laptop and build environment may be different each time.

Build reproducibility is planned for Websocat3. But if you contribute an updated Dockerfile and Github Actions configs for it (I never used myself Github Actions yet) then I will likely use it when creating releases; and pending release of Websocat 1.10.0 with some bugfixes will have a Docker Hub image.

Dreamacro commented 2 years ago

Okay, I would fix Dockerfile first, and then take a look at how the Github Actions work for the rust binary.

There are two options: push docker image to Docker Hub or Github Packages, but additional secrets need to be configured in the project

The example

- name: Login to DockerHub
  uses: docker/login-action@v1
  with:
    username: ${{ secrets.DOCKER_USERNAME }}
    password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to Github Package
  uses: docker/login-action@v1
  with:
    registry: ghcr.io
    username: Dreamacro
    password: ${{ secrets.PACKAGE_TOKEN }}
vi commented 2 years ago

Docker Hub or Github Packages

What are pros and cons and why not both?

Dreamacro commented 2 years ago

Dockerhub is the most widely used, but due to the commercialization process of Docker.Inc, the free service may be discontinued at some point in the future (It currently has a limit on the number of requests). https://www.docker.com/increase-rate-limits/

As of now, Github has an optimistic attitude towards open source projects, so it's a good idea to use Github Packages as a fallback option.

vi commented 2 years ago

Uploaded https://github.com/vi/websocat/pkgs/container/websocat and https://hub.docker.com/r/vi0oss/websocat

(manually, without Github Actions yet)

Are them OK?

Dreamacro commented 2 years ago

It works great! But I think it might be necessary to provide some additional OS platforms (like linux/arm/v6 linux/arm/v7 and linux/arm64).

BTW, Do you still need Github Actions that are built automatically (and can be triggered manually)?

vi commented 2 years ago

Configuring CI is planned, but maybe not for this release (0.10.0).

I need to educate myself about Github Actions first.

Dreamacro commented 2 years ago

https://github.com/Dreamacro/clash/blob/master/.github/workflows/docker.yml

Here's the Github Actions example I'm using, which requires a small tweak in the Dockerfile for Go, and I don't know if it's needed for Rust

flavono123 commented 1 year ago

One of hope for this.

vi commented 1 year ago

@flavono123 What hope?

If you need Docker images for amd64 Websocat you already can use it.

akostadinov commented 12 months ago

Something seems broken with current image:

$ podman run --rm -ti --entrypoint /bin/sh ghcr.io/vi/websocat:0.11.0
/ # websocat ws://ws.vi-server.org/mirror
Segmentation fault (core dumped)

Update: version 0.10.0 works though. I filed #190 to get builds automatically. I couldn't test it but I have same workflow working for another project of mine.

Update 2: it also segfaulted on wss addresses. But this unofficial image worked https://hub.docker.com/r/xasx/websocat If new ci build still has issues, maybe also Dockerfile will need some fix

vi commented 12 months ago

Reproduced with Docker as well:

# docker run --rm -ti ghcr.io/vi/websocat:0.11.0 ws://ws.vi-server.org/mirror
# echo $?
139

# docker run --rm -ti ghcr.io/vi/websocat:0.10.0 ws://ws.vi-server.org/mirror
12345
12345
abcde
abcde
# docker run --rm -ti ghcr.io/vi/websocat:0.10.0 wss://ws.vi-server.org/mirror
# echo $?
139

Not sure why it fails, I remember checking the Docker build, at least for 1.10.0.

(also noticed "0." instead of "1." in container tags)