-
Notifications
You must be signed in to change notification settings - Fork 7
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 #21
Add Dockerfile #21
Conversation
Added GH actions workflow to build amd64 and arm64 images and push to github container registry for current repo Docker images can be seen here https://github.com/intermittentnrg/grafanimate/pkgs/container/grafanimate Build from workflow here: https://github.com/intermittentnrg/grafanimate/pull/3/checks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi again, I've cherry-picked your Dockerfile into GH-24, and added our well-known recipe about OCI->GHCR publishing to it, following your intentions. With kind regards, |
Yes I used https://github.com/docker/build-push-action instructions and examples also, but went with parallel github worker per platform per example here https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners. Building arm64 images with qemu can be very slow, but seems not to be an issue for grafanimate. Also if you have any suggestions on the Dockerfile it would be great. It's a first attempt. Should maybe switch to from ubuntu to alpine for base image... |
Hi again,
I already started to build upon your proposal on behalf of GH-24. We discourage Alpine-based images, due to subtle differences compared to glibc. Specifically when running a huge software stack including Firefox, this is even more important. With kind regards, |
There is a alpine package for firefox available though. https://wiki.alpinelinux.org/wiki/Firefox I try to use alpine if possible and have used it for python applications in production environment without issues. |
We love the musl project, and it is becoming more mature every day. Still, we didn't regain enough trust, and don't bother too much about it. There are a few more pointers on this discussion - admitted, it's already from a few years ago ;]. Other than potential differences between musl and glibc, the package management is also different than Debian, so we would need to re-learn, or maintain a different stack. It is not worth the time for us, we are clearly on the Debian side of "maintenance convenience and peace of mind", optimizing for re-using well-established recipes across all the projects we maintain. |
Dockerfile
Outdated
RUN python3 setup.py develop | ||
|
||
ENV PATH /usr/lib/firefox-esr:/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin: | ||
CMD xvfb-run python -c 'from grafanimate.commands import run; run()' --header-layout=no-chrome --scenario=scenarios.py:ontario_windsolar --output=./animations --video-fps=30 --video-framerate=30 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to do something here, as we can't ship an OCI container including a specific command. However, I am struggling to generalize this, see #24 (comment). Maybe you can help?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just pushed dcee772 please squash this into my Add dockerfile commit that you cherry picked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new Dockerfile looks like this: https://github.com/panodata/grafanimate/blob/dockerize/Dockerfile. xauth
has been added, the ENTRYPOINT
is apparently still wrong, and doesn't do DWIM yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works in dcee772
$ docker run --rm grafanimate
Error: Parameter --scenario is mandatory
Usage:
grafanimate [options] [--target=<target>]...
grafanimate --version
grafanimate (-h | --help)
$ docker run --rm grafanimate --header-layout=no-chrome --scenario=scenarios.py:gb_windsolar --output=./animations --video-fps=30 --video-framerate=30 --exposure-time=0.2
2023-10-16 22:53:27,111 [grafanimate.grafana ] INFO : Starting GrafanaWrapper on https://grafana-backup.int.mog.se/d/e0a625dd-20a9-447a-92d8-55eef5b6b077/generation-mix-grafanimate-gb?orgId=1&kiosk=1
2023-10-16 22:53:27,111 [grafanimate.marionette ] INFO : Starting Marionette Gecko wrapper
2023-10-16 22:53:27,112 [grafanimate.marionette ] INFO : Found "firefox" program at /usr/lib/firefox-esr/firefox-esr
2023-10-16 22:53:27,112 [grafanimate.marionette ] INFO : Check for running instance of Marionette/Firefox at localhost:2828
2023-10-16 22:53:27,112 [grafanimate.marionette ] INFO : Will launch new Marionette/Firefox instance
mozversion INFO | application_buildid: 20230918121054
mozversion INFO | application_changeset: 17bedcda2f5c28b7fbc136d300bdbbf04f382e00
..............
2023-10-16 22:53:39,052 [grafanimate.grafana ] INFO : Timewarp to 2022-10-01 00:00:00 -> 2022-10-31 00:00:00
2023-10-16 22:53:39,134 [grafanimate.animations ] INFO : Waiting for 0.2 seconds (exposure time)
2023-10-16 22:53:39,335 [grafanimate.grafana ] INFO : Timewarp to 2022-10-01 04:00:00 -> 2022-10-31 04:00:00
2023-10-16 22:53:39,428 [grafanimate.animations ] INFO : Waiting for 0.2 seconds (exposure time)
I have not tested the results all the way... ohh and ffmpeg will be missing. But it runs!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does docker run --rm grafanimate --version
work for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ docker run --rm -it grafanimate -- --version
grafanimate 0.7.0
It does with extra --
before --version
This is confusing, let's move to your PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that, but the same happens over there as well.
Also works, it does not have to be the --
infix, let's just use foo
: ;]
$ docker run --rm local/grafanimate foo --version
grafanimate 0.7.0
Both funny and confusing. 😆
It's basically just |
It is not about this specific recipe. It is about that we want to use the same kinds of recipes across many projects, and need to keep a reasonably universal setup to keep our sanity. Thanks for your understanding ;]. |
dcee772
to
43ad434
Compare
f06bae8
to
41ab012
Compare
|
||
COPY . /app | ||
|
||
ENTRYPOINT ["/tini", "--", "xvfb-run", "python", "-c", "from grafanimate.commands import run; run()"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for discovering the right solution here, I've added it to the other PR with 7419f1c.
candidates = where.where("firefox") | ||
candidates += [ | ||
candidates = [ | ||
"/usr/lib/firefox-esr/firefox-esr", | ||
"/Applications/Firefox.app/Contents/MacOS/firefox-bin", | ||
] | ||
candidates += where.where("firefox") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again. Added with f784511.
GH-24 has been merged, therefore I am closing this. Thanks for all the fish. |
A work in progress submitted for any feedback.
Since some animations take some time to render, especially with --exposure-time, and before I added #19, I thought I will run it as container from pipeline.
You may notice I don't usually write python. Submitted for early feedback.
Also it should build container from github actions and push image to github container registry.