-
Notifications
You must be signed in to change notification settings - Fork 472
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
Make docker image more portable #1233
Conversation
Dockerfile
Outdated
@@ -26,7 +26,7 @@ RUN apt install -y git gcc g++ make cmake autoconf automake libtool python3 libs | |||
WORKDIR /kvrocks | |||
|
|||
COPY . . | |||
RUN ./x.py build -DENABLE_OPENSSL=ON | |||
RUN ./x.py build -DENABLE_OPENSSL=ON -DPORTABLE=ON |
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.
Why portable is ON if the binary is built inside Ubuntu and is launching inside Ubuntu?
I guess arch-specific optimizations could be applied in this case because we are fully aware of the target platform (Ubuntu). Correct me if I'm wrong.
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.
For example, if the build machine (Travis CI here) has avx512 instructions, the built binary will use these instructions to perform vectorize optimization if -march=native
is ON. But maybe user's device does not support avx512.
Dockerfile
Outdated
@@ -26,7 +26,7 @@ RUN apt install -y git gcc g++ make cmake autoconf automake libtool python3 libs | |||
WORKDIR /kvrocks | |||
|
|||
COPY . . | |||
RUN ./x.py build -DENABLE_OPENSSL=ON | |||
RUN ./x.py build -DENABLE_OPENSSL=ON -DPORTABLE=ON |
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'd suggest adding an ARG
and defaulting to ON
.
Our image can always use the default but if users are certain for the platform they can build their own with PORTABLE=OFF
.
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.
done. since other build arguments can also have this problem like ENABLE_SSL, DISABLE_JEMALLOC, so I add $MORE_BUILD_ARGS instead of $PORTABLE for more general purpose.
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.
Comment above.
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.
For confirmation, will MORE_BUILD_ARGS
override ENABLE_OPENSSL
and PORTABLE
if specified?
Yeah. |
Thanks all. Merging... |
It is a known issue that some users encountered "illegal instruction" crash while using our docker images, see #1146.
After investigation, RocksDB use
march=native
while thePORTABLE
option is set to OFF.We keep the default behavior for best performance, but use
PORTABLE=ON
in docker images to prevent illegal instructions.