-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
[WIP] Hadolint recommendations #41
base: main
Are you sure you want to change the base?
Conversation
|
||
CMD mkdir -p /root/xcode && \ | ||
clang -O3 -llzma -lxar -I /usr/local/include pbzx.c -o pbzx && \ | ||
mkdir -p /root/xcode && \ |
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.
Merge into run command. Separate CMD w/ json format
Dockerfile.ubuntu-32
Outdated
ln -sf /usr/bin/g++-8 /usr/bin/g++ && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/ && \ | ||
rm ./*.deb |
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.
clean up files on the layer that installs them
@@ -33,11 +38,8 @@ RUN cp -a /root/files/${mono_version} /root && \ | |||
wget https://download.mono-project.com/repo/ubuntu/pool/main/c/core-setup/msbuild-libhostfxr_3.0.0.2019.04.16.02.13-0xamarin3+ubuntu1604b1_i386.deb && \ | |||
wget https://download.mono-project.com/repo/ubuntu/pool/main/m/msbuild/msbuild-sdkresolver_16.3+xamarinxplat.2019.08.08.00.55-0xamarin2+ubuntu1604b1_all.deb && \ | |||
wget https://download.mono-project.com/repo/ubuntu/pool/main/n/nuget/nuget_5.2.0.6090.bin-0xamarin1+ubuntu1604b1_all.deb && \ | |||
dpkg -i --force-all *.deb && \ | |||
dpkg -i --force-all ./*.deb && \ |
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.
avoid files that begin with -
from being interpreted as an option
@@ -3,7 +3,9 @@ FROM godot-mono:${img_version} | |||
|
|||
ARG mono_version | |||
|
|||
RUN if [ -z "${mono_version}" ]; then echo -e "\n\nargument mono-version is mandatory!\n\n"; exit 1; fi && \ | |||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] |
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.
script stops if either side of a pipe fail
In spite of what hadolint says,
Making this one WIP while I figure it out. |
I ran http://github.com/hadolint/hadolint per calinou. This resulted in 45 best practices warnings. I fixed all except for using WORKDIR instead of cd, and pinning apt-get installs (and dnf) to specific versions).
Key takeaways:
|
should haveSHELL ["/bin/bash", "-o", "pipefail", "-c"]
before RUN so it will fail if either side of the pipe fails.*.deb
should begin with./*.deb
in case a file begins with a hyphen so it's not interpreted as an option.-e
onecho
is not a POSIX standard and printf is recommended.CMD
is a json list, so should be formatted asCMD ["/bin/bash"]