Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dockerfile and publish image to container registries #62

Merged
merged 3 commits into from
Feb 28, 2023

Conversation

imiric
Copy link
Contributor

@imiric imiric commented Feb 23, 2023

This allows using xk6 via Docker, without having to setup a local Go environment or install xk6.

Unfortunately, file permissions with mounted volumes are still an issue, without a simple, native fix. fixuid seems to be the modern solution to this, and works well from my tests.

The grafana/xk6 image isn't published yet, which will be done after this is merged, and we make a new release. I've tested publishing to GHCR in my fork, which worked fine.

In the meantime, you can build it with e.g. docker build -t test/xk6 ..

Closes #8

@imiric
Copy link
Contributor Author

imiric commented Feb 23, 2023

It would probably be good to add some CI tests for the image, right?

I can do that later today.

Copy link
Contributor

@olegbespalov olegbespalov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I belive the image test in CI step is a requirement for image publishing, so I'm fine to address it in the following PR.

👍

README.md Outdated Show resolved Hide resolved
Dockerfile Show resolved Hide resolved
This allows using xk6 via Docker, without having to setup a local Go
environment or install xk6.

Unfortunately, file permissions with mounted volumes are still an
issue[1], without a simple, native fix. fixuid[2] seems to be the modern
solution to this, and works well from my tests.

Part of #8

[1]: moby/moby#7198

[2]: https://github.com/boxboat/fixuid
Copy link
Contributor

@mstoykov mstoykov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👏

Let's see now how many people have really hard time getting the mounting of a local direcotry to work 😅

@imiric
Copy link
Contributor Author

imiric commented Feb 27, 2023

I'm not quite finished with this, as I want to invite people on macOS and Windows using Docker Desktop to try this out, and see if it works for them as well. 🤞

And while I tested the Docker release to GHCR in my fork, we also need to push the image to Docker Hub, so I'll need some help from DevOps, or whoever is managing the Grafana org to create the initial package we can push to.

The grafana/xk6 image isn't published yet, which I'll do after the
Dockerfile is approved.

In the meantime, you can build it with e.g.:

docker build -t test/xk6 .
@imiric
Copy link
Contributor Author

imiric commented Feb 27, 2023

OK, this should be done now. We confirmed the image works on macOS and Windows, and I updated the instructions.

I also added pushing to Docker Hub. grafana/xk6 is now available, but I haven't yet tested pushing to it. I added the secrets to the repo, and mostly copied the commands from the k6 workflow, so it should work once this is merged. 🤞

@imiric imiric changed the title Add Dockerfile Add Dockerfile and publish image to container registries Feb 27, 2023
Copy link
Contributor

@olegbespalov olegbespalov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Copy link
Contributor

@javaducky javaducky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Confirmed on Apple silicon.

```

For the native Windows binary if you're using cmd.exe:
```batch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```batch
```bash

Copy link
Contributor Author

@imiric imiric Feb 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this is Windows Batch file syntax. I wasn't sure if cmd.exe or batch would work, but batch seems to highlight some syntax, so it's good enough. 🤷‍♂️

@imiric
Copy link
Contributor Author

imiric commented Feb 28, 2023

Thanks for the reviews and testing, everyone! 🙇

In the latest force push I just split the Docker steps for GHCR and Docker Hub, as they're in the k6 workflow file, to avoid breaking publishing on one registry if the other is down.

I'll merge this, and make a release soon (after #60), so we can test the full release process. 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Have a docker image that has golang and you can directly use with xk6
4 participants