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 #315

Merged
merged 1 commit into from Oct 26, 2021
Merged

Add Dockerfile #315

merged 1 commit into from Oct 26, 2021

Conversation

ghost
Copy link

@ghost ghost commented Oct 25, 2021

The whole idea behind this, is to offer a easier way to test selene and even use it on projects without the need of setting up Rust on the host machine, it's somewhat similar to the one on git-cliff

In short, this Dockerfile basically installs selene from cargo (both the normal and light version of selene) and compiles them on a musl and glibc environments (Alpine and Debian, respectively), i even published a demo on Docker Hub with binaries built from 0.14.0 source

The image has 4 tags

  • selene:0.14.0
  • selene:light-0.14.0
  • selene:musl-0.14.0
  • selene:musl-light-0.14.0

In order to build it, you must have docker installed, and run the following command:

DOCKER_BUILDKIT=1 docker build \
   --target selene -t henriquehbr/selene:0.14.0 \
   --target selene-light -t henriquehbr/selene:light-0.14.0 \
   --target selene-musl -t henriquehbr/selene:musl-0.14.0 \
   --target selene-light-musl -t henriquehbr/selene:light-musl-0.14.0 .

The DOCKER_BUILDKIT environment variable tells docker to use BuildKit to build it's image, which results in faster build times, more details here

As this might be a unpleasantly long command to type, maybe something like a Makefile would come in handy, but ultimately, such decision is up to you

Another important detail, is regarding the selene installation process inside the Dockerfile, which would depend on you publishing selene crate first, and then building the image and pushing it to Docker Hub, if you prefer, we can change it to compile directly from the source, let me know what you think as the best way of doing that

@Kampfkarren
Copy link
Owner

Pretty nice! I don't really know how to review this, but from what I know, LGTM.

@Kampfkarren Kampfkarren merged commit 9d56902 into Kampfkarren:main Oct 26, 2021
@Kampfkarren
Copy link
Owner

For the record, I don't really want to add any new commands to my workflow on publishing selene, it's already a bit of a headache.

We have a publish workflow already, would be best to throw it in there.

@ghost
Copy link
Author

ghost commented Oct 26, 2021

@Kampfkarren Unfortunately, i'm not that familiar with GitHub Actions (nor with any other CI service out there), but i've been taking a look at build.yml, and to be honest, it looks pretty simple so far, if you don't mind, i can also open another PR to automate the publication of the Docker image

I'm not sure how it would be done in terms of safely storing credentials on a GitHub Actions workflow, ideally those Docker images should be published under a Docker Hub account of yours

@Kampfkarren
Copy link
Owner

If you look up Docker publish action, you should find what you need.

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.

1 participant