From 04b56e72b3db294369872ab1582759157c61788f Mon Sep 17 00:00:00 2001 From: Peter White <23270067+peterwht@users.noreply.github.com> Date: Fri, 23 Feb 2024 16:21:42 -0700 Subject: [PATCH] feat: add dockerfile (#3) Co-authored-by: Frank Bell --- .dockerignore | 8 ++++++++ Dockerfile | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..b0c40bf1 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.git +**/target/ +**/*.txt +**/*.md +/docker/ + +# dotfiles in the repo root +/.* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..b7b01b44 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# This file is sourced from https://github.com/paritytech/polkadot-sdk/blob/master/docker/dockerfiles/polkadot/polkadot_builder.Dockerfile +FROM docker.io/paritytech/ci-linux:production as builder +# Require the current commit hash to be provided as an argument +ARG SUBSTRATE_CLI_GIT_COMMIT_HASH +RUN test -n "$SUBSTRATE_CLI_GIT_COMMIT_HASH" || (echo "SUBSTRATE_CLI_GIT_COMMIT_HASH not set, provide via --build-arg SUBSTRATE_CLI_GIT_COMMIT_HASH=(git rev-parse --short=11 HEAD)" && false) +ENV SUBSTRATE_CLI_GIT_COMMIT_HASH=$SUBSTRATE_CLI_GIT_COMMIT_HASH +WORKDIR /pop +COPY . /pop +RUN cargo build --release + +# Build image +FROM debian:bullseye-slim as collator +COPY --from=builder /pop/target/release/pop-node /usr/bin/pop-node +CMD ["/usr/bin/pop-node"]