Closed Dreamacro closed 7 months ago
I remember somebody contributing a Dockerfile for Websocat. Does it still work? (I don't use it myself).
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?
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.
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 }}
Docker Hub or Github Packages
What are pros and cons and why not both?
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.
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?
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)?
Configuring CI is planned, but maybe not for this release (0.10.0).
I need to educate myself about Github Actions first.
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
One of hope for this.
@flavono123 What hope?
If you need Docker images for amd64 Websocat you already can use it.
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
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)
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.