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: make Dockerfile build #5271

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
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
21 changes: 8 additions & 13 deletions Dockerfile
mversic marked this conversation as resolved.
Show resolved Hide resolved
mversic marked this conversation as resolved.
Show resolved Hide resolved
mversic marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
# base stage
FROM debian:bookworm-slim AS builder
# builder stage
FROM rust:slim-bookworm AS builder

WORKDIR /app

# install required packages
RUN apt-get update -y && \
apt-get install -y curl build-essential mold pkg-config libssl-dev
apt-get install -y build-essential mold

# set up Rust toolchain
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN rustup toolchain install nightly-2024-09-09
RUN rustup default nightly-2024-09-09
RUN rustup target add wasm32-unknown-unknown
RUN rustup component add rust-src
RUN rustup default nightly-2024-09-09

# builder stage
WORKDIR /iroha
COPY . .
ARG PROFILE="deploy"
ARG RUSTFLAGS=""
ARG FEATURES=""
ARG CARGOFLAGS=""
RUN RUSTFLAGS="${RUSTFLAGS}" mold --run cargo ${CARGOFLAGS} build --target x86_64-unknown-linux-gnu --profile "${PROFILE}" --features "${FEATURES}"
RUN RUSTFLAGS="${RUSTFLAGS}" mold --run cargo ${CARGOFLAGS} build --profile "${PROFILE}" --features "${FEATURES}"

# final image
FROM debian:bookworm-slim

ARG PROFILE="deploy"
ARG STORAGE=/storage
ARG TARGET_DIR=/iroha/target/x86_64-unknown-linux-gnu/${PROFILE}
ARG TARGET_DIR=/app/target/${PROFILE}
ENV BIN_PATH=/usr/local/bin/
ENV CONFIG_DIR=/config
ENV KURA_STORE_DIR=$STORAGE
Expand Down Expand Up @@ -63,7 +59,6 @@ COPY --from=builder $TARGET_DIR/iroha $BIN_PATH
COPY --from=builder $TARGET_DIR/kagami $BIN_PATH
COPY defaults/genesis.json $CONFIG_DIR
COPY defaults/executor.wasm $CONFIG_DIR
COPY defaults/libs $CONFIG_DIR/libs/
COPY defaults/client.toml $CONFIG_DIR
USER $USER
CMD ["irohad"]
1 change: 0 additions & 1 deletion Dockerfile.musl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ COPY --from=builder $TARGET_DIR/iroha $BIN_PATH
COPY --from=builder $TARGET_DIR/kagami $BIN_PATH
COPY defaults/genesis.json $CONFIG_DIR
COPY defaults/executor.wasm $CONFIG_DIR
COPY defaults/libs $CONFIG_DIR/libs/
COPY defaults/client.toml $CONFIG_DIR
USER $USER
CMD ["irohad"]
Loading