Skip to content

Commit

Permalink
Use Rust docker image for building the binary
Browse files Browse the repository at this point in the history
  • Loading branch information
gpmayorga committed Nov 17, 2023
1 parent 3e9b865 commit bfc67a5
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions docker/centrifuge-chain/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# https://github.com/paritytech/polkadot-sdk/blob/master/docker/dockerfiles/polkadot/polkadot_injected_release.Dockerfile

# ToDo: create a CI/builder image with preloaded tools
FROM --platform=linux/amd64 docker.io/library/ubuntu:22.04 as builder

# FROM --platform=linux/amd64 docker.io/library/ubuntu:22.04 as builder
FROM --platform=linux/amd64 docker.io/library/rust:bookworm as builder
# Defaults
ENV RUST_BACKTRACE 1
ENV DEBIAN_FRONTEND=noninteractive
Expand All @@ -20,17 +20,10 @@ FROM --platform=linux/amd64 docker.io/library/ubuntu:22.04 as builder
protobuf-compiler \
curl

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
COPY ./scripts scripts
COPY rust-toolchain.toml ./
# install rustup, use minimum components
RUN curl -L "https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init" \
-o rustup-init; \
chmod +x rustup-init; \
mv rustup-init /usr/local/bin/rustup

# RUN rustup update && rustup default
ENV PATH=~/.cargo/bin:$PATH
RUN scripts/install_toolchain.sh

# BUILD
Expand All @@ -48,7 +41,7 @@ FROM --platform=linux/amd64 docker.io/library/ubuntu:22.04 as builder

# ===== SECOND STAGE ======
# ToDo: create a secure image as a base for the binary
FROM --platform=linux/amd64 docker.io/library/ubuntu:22.04
FROM --platform=linux/amd64 docker.io/library/ubuntu:latest

LABEL io.centrifuge.image.authors="[email protected]" \
io.centrifuge.image.vendor="Centrifuge" \
Expand All @@ -75,6 +68,7 @@ FROM --platform=linux/amd64 docker.io/library/ubuntu:22.04
RUN mkdir -p /root/.local/share/centrifuge-chain && \
ln -s /root/.local/share/centrifuge-chain /data


ENV RUST_BACKTRACE 1
USER centrifuge
EXPOSE 30333 9933 9944
Expand Down

0 comments on commit bfc67a5

Please sign in to comment.