Skip to content

Commit

Permalink
docker: Add Dockerfile (#1111)
Browse files Browse the repository at this point in the history
Co-authored-by: fikgol <[email protected]>
Co-authored-by: jolestar <[email protected]>
  • Loading branch information
3 people authored Aug 12, 2020
1 parent 36e02b4 commit 486d08a
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target/*
59 changes: 59 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
FROM ubuntu:bionic AS builder

RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
libc6-dev \
git \
libssl-dev \
wget \
pkg-config \
libclang-dev clang; \
rm -rf /var/lib/apt/lists/*

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUSTUP_VERSION=1.22.1 \
RUSTUP_SHA256=49c96f3f74be82f4752b8bffcf81961dea5e6e94ce1ccba94435f12e871c3bdb \
RUST_ARCH=x86_64-unknown-linux-gnu

RUN set -eux; \
url="https://static.rust-lang.org/rustup/archive/${RUSTUP_VERSION}/${RUST_ARCH}/rustup-init"; \
wget "$url"; \
echo "${RUSTUP_SHA256} *rustup-init" | sha256sum -c -; \
chmod +x rustup-init

ENV RUST_VERSION=1.45.0

RUN set -eux; \
./rustup-init -y --no-modify-path --default-toolchain $RUST_VERSION; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
cargo --version; \
rustc --version;

WORKDIR /starcoin
COPY ./ .
RUN cargo build --release

FROM ubuntu:bionic
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates \
libssl-dev; \

rm -rf /var/lib/apt/lists/*

ENV RELEASE_PATH="/starcoin/target/release"
COPY --from=builder $RELEASE_PATH/starcoin \
$RELEASE_PATH/starcoin_miner \
$RELEASE_PATH/txfactory \
$RELEASE_PATH/faucet \
/starcoin/

CMD ["/starcoin/starcoin"]

0 comments on commit 486d08a

Please sign in to comment.