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
Build: Streamline and sync dockerfiles #58101
Conversation
Drone build failed: https://drone.grafana.net/grafana/grafana-enterprise/40532 |
c441deb
to
f2244bf
Compare
Drone build failed: https://drone.grafana.net/grafana/grafana-enterprise/41224 |
Drone build failed: https://drone.grafana.net/grafana/grafana-enterprise/41298 |
3bbcc9a
to
b540d72
Compare
Drone build failed: https://drone.grafana.net/grafana/grafana-enterprise/41752 |
b540d72
to
7aed967
Compare
7aed967
to
d893e15
Compare
this PR potentially fixes #58921 |
This does build cleanly for me, less some minor mods for injecting ca-certifcates. However it failes at runtime: |
Hmm, might be an issue with the |
I haven't been able to duplicate the problem, test images built using all 4 of these methods work as expected:
You mentioned mods to inject ca-certificates, did you possibly do something that would change the PATH setting? We set the path to |
I did not.
I did, however, what I believe to be a working patch to main in the comments on make build-docker-full* fails · Issue #58921 · grafana/grafana (github.com)<#58921>.
From: Dan Cech ***@***.***>
Sent: Sunday, November 20, 2022 5:08 PM
To: grafana/grafana ***@***.***>
Cc: Eaton, Michael [US] (DS) ***@***.***>; Comment ***@***.***>
Subject: EXT :Re: [grafana/grafana] Build: Streamline and sync dockerfiles (PR #58101)
This does build cleanly for me, less some minor mods for injecting ca-certifcates. However it failes at runtime: /run.sh: line 80: exec: grafana-server: not found
Hmm, might be an issue with the PATH changes, thanks for the feedback I'll check it out.
I haven't been able to duplicate the problem, test images built using all 4 of these methods work as expected:
make build-docker-full
make build-docker-full-ubuntu
GRAFANA_TGZ=grafana-9.2.3.linux-amd64.tar.gz ./build.sh --fast 9.2.3
GRAFANA_TGZ=grafana-9.2.3.linux-amd64.tar.gz ./build.sh --fast --ubuntu 9.2.3
You mentioned mods to inject ca-certificates, did you possibly do something that would change the PATH setting?
We set the path to ENV PATH="/usr/share/grafana/bin:$PATH" which is what allors run.sh to find the grfana-server binary without an explicit path being specified, so if the PATH does not include /usr/share/grafana/bin it won't work.
—
Reply to this email directly, view it on GitHub<#58101 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A3FKSBVBA65WPAC4YRQNMNDWJKONBANCNFSM6AAAAAARVSAMTI>.
You are receiving this because you commented.Message ID: ***@***.******@***.***>>
|
That should not be required with this branch, it includes an update that fixes the problem that patch was trying to solve. |
Hi! I might be wrong, but shouldn't there be a semicolon before the backslash? https://github.com/grafana/grafana/pull/58101/files#diff-dfdb3f200d18eadfb7dca9193b67c2b8b5c8e59472317372b14bb9f3ad1fe04fR15 if [ $GF_INSTALL_IMAGE_RENDERER_PLUGIN = "true" ]; then \
apk add --no-cache udev ttf-opensans chromium \
fi -> if [ $GF_INSTALL_IMAGE_RENDERER_PLUGIN = "true" ]; then \
apk add --no-cache udev ttf-opensans chromium ; \
fi |
you're absolutely correct, I'll open a PR to fix that! |
Hello @DanCech!
Please, if the current pull request addresses a bug fix, label it with the |
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-58101-to-v9.3.x origin/v9.3.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 9fec54df2dd37c68b26f0d59d809924ea3342cf1
# Push it to GitHub
git push --set-upstream origin backport-58101-to-v9.3.x
git switch main
# Remove the local backport branch
git branch -D backport-58101-to-v9.3.x Then, create a pull request where the |
* streamline and sync dockerfiles * improve go dependency cacheability * unify alpine and ubuntu Dockerfiles * include glibc support in locally-built alpine images (cherry picked from commit 9fec54d)
* streamline and sync dockerfiles * improve go dependency cacheability * unify alpine and ubuntu Dockerfiles * include glibc support in locally-built alpine images
* streamline and sync dockerfiles * improve go dependency cacheability * unify alpine and ubuntu Dockerfiles * include glibc support in locally-built alpine images (cherry picked from commit 9fec54d)
* streamline and sync dockerfiles * improve go dependency cacheability * unify alpine and ubuntu Dockerfiles * include glibc support in locally-built alpine images (cherry picked from commit 9fec54d)
* Build: Streamline and sync dockerfiles (#58101) --------- Co-authored-by: gotjosh <josue.abreu@gmail.com> Co-authored-by: Kevin Minehart <kmineh0151@gmail.com>
While working on #58005 I noticed many inconsistencies between our various dockerfiles as well as opportunities to streamline them.
This PR attempts to take the best parts of our various dockerfiles and align between alpine and ubuntu as well as between dev and packaging. It also syncs and streamlines the custom dockerfiles.
RUN
statements to reduce layer countRUN
indentationCOPY
statementsUSER "$GF_UID"
across all images for maximum compatibility/tmp/grafana
for build & temp filesARG GF_GID="0"
After the dockerfiles were in sync I observed that the differences between alpine and ubuntu dockerfiles were relatively small and isolated to the RUN commands and underlying images, so by updating the RUN commands to detect alpine or ubuntu and updating the build scripts to pass the correct images as build args we can consolidate to 2 docker images.
In a follow-up PR we should be able to use buildkit to combine the main and packaging dockerfiles into a single dockerfile that detects whether a tarball is provided and either extracts that or builds the source.