-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
docker: fix dart-sass arch mismatch, /cache permissions #12959
Conversation
@bep can you try building a dart-sass project with this version? I pushed an image of this build to docker run -v .:/project davidkarlsson416/hugo:12959 build |
Works great, thanks. |
The Docker build currently installs curl as a runtime dependency in the final Dockerfile stage. The shell script to install the dart-sass is also included in the final image. This change moves the dart-sass download to a separate stage and copies the binary over to the final stage. It also fixes dart-sass for multi-platform builds by changing BUILDARCH to TARGETARCH, ensuring that the dart-sass architecture matches the output platform instead of the build platform. Signed-off-by: David Karlsson <[email protected]>
Signed-off-by: David Karlsson <[email protected]>
700c52e
to
54011cf
Compare
@bep I saw your comment about |
@dvdksn yea, I removed that comment as I saw that we used ARG for the go versions. We can handle this later, but your argument only makes sense if Docker had a concept of "private ARGs". As I understand it:
|
Yes I get it, the ability to set these args on the command line is not desirable. But |
How is it better? My argument is above is that the only practical difference in the "dart sass version" case above is that ARG can be set from the outside, which is a negative; what are the positive sides of ARG that outweighs the negative? |
In this specific case, no real benefit; it's just more idiomatic. I think it's better to use |
https://www.docker.com/blog/docker-best-practices-using-arg-and-env-in-your-dockerfiles/#tldr Also note:
|
I have not found any example/documentation about how to pass ENV variables from the command line to |
You can't. You can't change the value of |
Elsewhere in that article the author provides this example (which I have not tested):
|
Sure, but the discussion above is about |
Gotcha. When reading the article I didn't notice that |
The dart-sass setup used the
$BUILDARCH
variable to fetch the dart-sassbinary, which resulted in the wrong architecture being downloaded when building
for another architecture. The first commit changes it to use
$TARGETARCH
instead. It also simplifies/inlines the dart-sass setup.
The second commit fixes the permission issue with
/cache
being owned by root.