Skip to content

Commit

Permalink
chore: test working non-distroless build
Browse files Browse the repository at this point in the history
  • Loading branch information
BarryBoot committed Jul 17, 2024
1 parent 807665c commit 379b062
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
29 changes: 14 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
FROM rust:1.79.0-slim-bullseye AS chef

RUN apt-get update && apt-get -y --no-install-recommends install git build-essential m4 llvm libclang-dev diffutils curl cmake libglfw3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev python3
#RUN cargo install cargo-chef
RUN cargo install cargo-chef
WORKDIR /aiblock
ENV CARGO_TARGET_DIR=/aiblock

COPY . .
RUN cargo build --release
# FROM chef AS planner
FROM chef AS planner

# COPY . .
# RUN cargo chef prepare --recipe-path recipe.json
COPY . .
RUN cargo chef prepare --recipe-path recipe.json

# FROM chef AS builder
# COPY --from=planner /aiblock/recipe.json /aiblock/recipe.json
# RUN cargo chef cook --release --recipe-path /aiblock/recipe.json
# COPY . .
# RUN cargo build --release
FROM chef AS builder
COPY --from=planner /aiblock/recipe.json /aiblock/recipe.json
RUN cargo chef cook --release --recipe-path /aiblock/recipe.json
COPY . .
RUN cargo build --release

# Use distroless
#FROM cgr.dev/chainguard/glibc-dynamic:latest
#

FROM rust:1.79.0-slim-bullseye
RUN apt-get update && apt-get -y --no-install-recommends install libclang-dev libxinerama-dev
#USER nonroot

# Set these in the environment to override [use once we have env vars available]
Expand All @@ -37,14 +36,14 @@ ENV MEMPOOL_MINER_WHITELIST="/etc/mempool_miner_whitelist.json"
ENV RUST_LOG=info,debug

# Copy node bin
#COPY --from=builder /aiblock/release/node /aiblock/node
COPY --from=builder /aiblock/release/node /aiblock/aiblock
#COPY --from=builder /usr/lib/x86_64-linux-gnu/libX11.so.6 /usr/lib/x86_64-linux-gnu/libX11.so.6
RUN cp /aiblock/release/node /aiblock/node
#RUN cp /aiblock/release/node /aiblock/aiblock

# Default config for the node
COPY .docker/conf/* /etc/.

ENTRYPOINT ["/aiblock/node"]
ENTRYPOINT ["/aiblock/aiblock"]

CMD [$NODE_TYPE]

Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ services:
volumes:
- /tmp/mempool:/src
command: mempool
platform: linux/amd64
networks:
aiblock:
ipv4_address: 172.28.0.3
Expand All @@ -32,6 +33,8 @@ services:

miner-node:
<<: *node-default
environment:
RUST_LOG: trace
depends_on:
- mempool-node
- storage-node
Expand Down

0 comments on commit 379b062

Please sign in to comment.