Skip to content
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

fix(build): a path must exist before creating a file in it #5177

Merged
merged 3 commits into from
Sep 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,21 @@ RUN apt-get update && \
ARG CHECKPOINT_SYNC=true
ARG NETWORK=Mainnet

ARG ZEBRA_CONF_PATH=/etc/zebra/zebrad.toml
# Use a configurable dir and file for the zebrad configuration file
ARG ZEBRA_CONF_PATH=/etc/zebra
gustavovalverde marked this conversation as resolved.
Show resolved Hide resolved
ENV ZEBRA_CONF_PATH ${ZEBRA_CONF_PATH}

ARG ZEBRA_CONF_FILE=zebrad.toml
ENV ZEBRA_CONF_FILE ${ZEBRA_CONF_FILE}

# Build the `zebrad.toml` before starting the container, using the arguments from build
# time, or using the default values set just above.
# time, or using the default values set just above. And create the conf path and file if
# it does not exist
#
# TODO: move this file creation to an entrypoint as we can use default values at runtime,
# and modify those as needed when starting the container (at runtime and not at build time)
RUN mkdir -p ${ZEBRA_CONF_PATH} \
&& touch ${ZEBRA_CONF_PATH}/${ZEBRA_CONF_FILE}
RUN set -ex; \
{ \
echo "[consensus]"; \
Expand All @@ -156,7 +166,7 @@ RUN set -ex; \
echo "cache_dir = '/zebrad-cache'"; \
echo "[tracing]"; \
echo "endpoint_addr = '0.0.0.0:3000'"; \
} > "${ZEBRA_CONF_PATH}"
} > "${ZEBRA_CONF_PATH}/${ZEBRA_CONF_FILE}"

EXPOSE 3000 8233 18233

Expand All @@ -166,4 +176,5 @@ ENV SHORT_SHA $SHORT_SHA
ARG SENTRY_DSN
ENV SENTRY_DSN ${SENTRY_DSN}

CMD [ "zebrad", "-c", "${ZEBRA_CONF_PATH}", "start" ]
# TODO: remove the specified config file location and use the default expected by zebrad
CMD [ "zebrad", "-c", "${ZEBRA_CONF_PATH}/${ZEBRA_CONF_FILE}", "start" ]