-
Notifications
You must be signed in to change notification settings - Fork 649
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
Update Dockerfile and build-docker workflow #2666
Changes from all commits
9309426
6abef18
673035b
cd5a1d8
233dbb7
501cec4
65befca
cdc03c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
FROM phusion/baseimage:focal-1.2.0 | ||
MAINTAINER The bitshares decentralized organisation | ||
|
||
# The image for building | ||
FROM phusion/baseimage:focal-1.2.0 as build | ||
ENV LANG=en_US.UTF-8 | ||
|
||
# Install dependencies | ||
RUN \ | ||
apt-get update && \ | ||
apt-get upgrade -y -o Dpkg::Options::="--force-confold" && \ | ||
|
@@ -29,7 +30,6 @@ RUN \ | |
libtool \ | ||
doxygen \ | ||
ca-certificates \ | ||
fish \ | ||
&& \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
@@ -52,20 +52,50 @@ RUN \ | |
-DGRAPHENE_DISABLE_UNITY_BUILD=ON \ | ||
. && \ | ||
make witness_node cli_wallet get_dev_key && \ | ||
install -s programs/witness_node/witness_node programs/genesis_util/get_dev_key programs/cli_wallet/cli_wallet /usr/local/bin && \ | ||
install -s programs/witness_node/witness_node \ | ||
programs/genesis_util/get_dev_key \ | ||
programs/cli_wallet/cli_wallet \ | ||
/usr/local/bin && \ | ||
# | ||
# Obtain version | ||
mkdir -p /etc/bitshares && \ | ||
git rev-parse --short HEAD > /etc/bitshares/version && \ | ||
cd / && \ | ||
rm -rf /bitshares-core | ||
|
||
# Home directory $HOME | ||
# The final image | ||
FROM phusion/baseimage:focal-1.2.0 | ||
LABEL maintainer="The bitshares decentralized organisation" | ||
ENV LANG=en_US.UTF-8 | ||
|
||
# Install required libraries | ||
RUN \ | ||
apt-get update && \ | ||
apt-get upgrade -y -o Dpkg::Options::="--force-confold" && \ | ||
apt-get update && \ | ||
apt-get install --no-install-recommends -y \ | ||
libcurl4 \ | ||
ca-certificates \ | ||
&& \ | ||
mkdir -p /etc/bitshares && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
COPY --from=build /usr/local/bin/* /usr/local/bin/ | ||
COPY --from=build /etc/bitshares/version /etc/bitshares/ | ||
|
||
WORKDIR / | ||
RUN useradd -s /bin/bash -m -d /var/lib/bitshares bitshares | ||
RUN groupadd -g 10001 bitshares | ||
RUN useradd -u 10000 -g bitshares -s /bin/bash -m -d /var/lib/bitshares --no-log-init bitshares | ||
ENV HOME /var/lib/bitshares | ||
RUN chown bitshares:bitshares -R /var/lib/bitshares | ||
|
||
# default exec/config files | ||
ADD docker/default_config.ini /etc/bitshares/config.ini | ||
ADD docker/default_logging.ini /etc/bitshares/logging.ini | ||
ADD docker/bitsharesentry.sh /usr/local/bin/bitsharesentry.sh | ||
RUN chmod a+x /usr/local/bin/bitsharesentry.sh | ||
|
||
# Volume | ||
VOLUME ["/var/lib/bitshares", "/etc/bitshares"] | ||
|
||
|
@@ -74,14 +104,11 @@ EXPOSE 8090 | |
# p2p service: | ||
EXPOSE 1776 | ||
|
||
# default exec/config files | ||
ADD docker/default_config.ini /etc/bitshares/config.ini | ||
ADD docker/default_logging.ini /etc/bitshares/logging.ini | ||
ADD docker/bitsharesentry.sh /usr/local/bin/bitsharesentry.sh | ||
RUN chmod a+x /usr/local/bin/bitsharesentry.sh | ||
|
||
# Make Docker send SIGINT instead of SIGTERM to the daemon | ||
STOPSIGNAL SIGINT | ||
|
||
# Temporarily commented out due to permission issues caused by older versions, to be restored in a future version | ||
#USER bitshares:bitshares | ||
|
||
# default execute entry | ||
CMD ["/usr/local/bin/bitsharesentry.sh"] | ||
ENTRYPOINT ["/usr/local/bin/bitsharesentry.sh"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea to use an ENTRYPOINT VS a CMD. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,10 +84,17 @@ fi | |
ln -f -s /etc/bitshares/config.ini /var/lib/bitshares | ||
ln -f -s /etc/bitshares/logging.ini /var/lib/bitshares | ||
|
||
chown -R bitshares:bitshares /var/lib/bitshares | ||
|
||
# Get the latest security updates | ||
apt-get update && apt-get upgrade -y -o Dpkg::Options::="--force-confold" | ||
|
||
# Plugins need to be provided in a space-separated list, which | ||
# makes it necessary to write it like this | ||
if [[ ! -z "$BITSHARESD_PLUGINS" ]]; then | ||
exec "$BITSHARESD" --data-dir "${HOME}" ${ARGS} ${BITSHARESD_ARGS} --plugins "${BITSHARESD_PLUGINS}" | ||
exec /usr/bin/setpriv --reuid=bitshares --regid=bitshares --clear-groups \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, |
||
"$BITSHARESD" --data-dir "${HOME}" ${ARGS} ${BITSHARESD_ARGS} --plugins "${BITSHARESD_PLUGINS}" | ||
else | ||
exec "$BITSHARESD" --data-dir "${HOME}" ${ARGS} ${BITSHARESD_ARGS} | ||
exec /usr/bin/setpriv --reuid=bitshares --regid=bitshares --clear-groups \ | ||
"$BITSHARESD" --data-dir "${HOME}" ${ARGS} ${BITSHARESD_ARGS} | ||
fi |
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 like how you separated the build and runtime envionronments. Should make the final image smaller with fewer attack vectors.