Skip to content

Commit

Permalink
fix(docker): avoid using unexpected paths with a WORKDIR
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavovalverde committed Aug 29, 2024
1 parent 35c41a6 commit 1c242c3
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ ENV SHORT_SHA=${SHORT_SHA:-}

ENV CARGO_HOME="${APP_HOME}/.cargo/"

# Set the default path for the zebrad binary
# TODO: users should be able to set this to a different value
WORKDIR /opt/zebrad/

# In this stage we build tests (without running then)
#
# We also download needed dependencies for tests to work, from other images.
Expand Down Expand Up @@ -117,7 +121,7 @@ cp ${APP_HOME}/target/release/zebrad /usr/local/bin && \
cp ${APP_HOME}/target/release/zebra-checkpoints /usr/local/bin

# Copy the lightwalletd binary and source files to be able to run tests
COPY --from=electriccoinco/lightwalletd:latest /usr/local/bin/lightwalletd /usr/local/bin/
# COPY --from=electriccoinco/lightwalletd:latest /usr/local/bin/lightwalletd /usr/local/bin/
COPY ./ ./

COPY ./docker/entrypoint.sh /etc/zebrad/entrypoint.sh
Expand All @@ -140,20 +144,20 @@ FROM deps AS release

ARG FEATURES

RUN --mount=type=bind,source=zebrad,target=zebrad \
RUN --mount=type=bind,source=tower-batch-control,target=tower-batch-control \
--mount=type=bind,source=tower-fallback,target=tower-fallback \
--mount=type=bind,source=zebra-chain,target=zebra-chain \
--mount=type=bind,source=zebra-network,target=zebra-network \
--mount=type=bind,source=zebra-state,target=zebra-state \
--mount=type=bind,source=zebra-script,target=zebra-script \
--mount=type=bind,source=zebra-consensus,target=zebra-consensus \
--mount=type=bind,source=zebra-rpc,target=zebra-rpc \
--mount=type=bind,source=zebra-grpc,target=zebra-grpc \
--mount=type=bind,source=zebra-network,target=zebra-network \
--mount=type=bind,source=zebra-node-services,target=zebra-node-services \
--mount=type=bind,source=zebra-rpc,target=zebra-rpc \
--mount=type=bind,source=zebra-scan,target=zebra-scan \
--mount=type=bind,source=zebra-script,target=zebra-script \
--mount=type=bind,source=zebra-state,target=zebra-state \
--mount=type=bind,source=zebra-test,target=zebra-test \
--mount=type=bind,source=zebra-utils,target=zebra-utils \
--mount=type=bind,source=zebra-scan,target=zebra-scan \
--mount=type=bind,source=zebra-grpc,target=zebra-grpc \
--mount=type=bind,source=tower-batch-control,target=tower-batch-control \
--mount=type=bind,source=tower-fallback,target=tower-fallback \
--mount=type=bind,source=zebrad,target=zebrad \
--mount=type=bind,source=Cargo.toml,target=Cargo.toml \
--mount=type=bind,source=Cargo.lock,target=Cargo.lock \
--mount=type=cache,target=${APP_HOME}/target/ \
Expand All @@ -174,8 +178,6 @@ FROM debian:bookworm-slim AS runtime
ARG APP_HOME
ENV APP_HOME=${APP_HOME}
WORKDIR ${APP_HOME}
COPY --link --from=release /usr/local/bin /usr/local/bin
COPY --link --from=release /entrypoint.sh /

RUN apt-get update && \
apt-get install -y --no-install-recommends \
Expand Down

0 comments on commit 1c242c3

Please sign in to comment.