Skip to content

Commit

Permalink
Add Dockerfiles to the templates (paritytech#4637)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzadp authored and TarekkMA committed Aug 2, 2024
1 parent 9247ffa commit 52c4908
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 0 deletions.
3 changes: 3 additions & 0 deletions templates/minimal/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
target/
Dockerfile
.dockerignore
28 changes: 28 additions & 0 deletions templates/minimal/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM docker.io/paritytech/ci-unified:latest as builder

WORKDIR /polkadot
COPY . /polkadot

RUN cargo fetch
RUN cargo build --locked --release

FROM docker.io/parity/base-bin:latest

COPY --from=builder /polkadot/target/release/minimal-template-node /usr/local/bin

USER root
RUN useradd -m -u 1001 -U -s /bin/sh -d /polkadot polkadot && \
mkdir -p /data /polkadot/.local/share && \
chown -R polkadot:polkadot /data && \
ln -s /data /polkadot/.local/share/polkadot && \
# unclutter and minimize the attack surface
rm -rf /usr/bin /usr/sbin && \
# check if executable works in this container
/usr/local/bin/minimal-template-node --version

USER polkadot

EXPOSE 30333 9933 9944 9615
VOLUME ["/data"]

ENTRYPOINT ["/usr/local/bin/minimal-template-node"]
3 changes: 3 additions & 0 deletions templates/parachain/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
target/
Dockerfile
.dockerignore
28 changes: 28 additions & 0 deletions templates/parachain/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM docker.io/paritytech/ci-unified:latest as builder

WORKDIR /polkadot
COPY . /polkadot

RUN cargo fetch
RUN cargo build --locked --release

FROM docker.io/parity/base-bin:latest

COPY --from=builder /polkadot/target/release/parachain-template-node /usr/local/bin

USER root
RUN useradd -m -u 1001 -U -s /bin/sh -d /polkadot polkadot && \
mkdir -p /data /polkadot/.local/share && \
chown -R polkadot:polkadot /data && \
ln -s /data /polkadot/.local/share/polkadot && \
# unclutter and minimize the attack surface
rm -rf /usr/bin /usr/sbin && \
# check if executable works in this container
/usr/local/bin/parachain-template-node --version

USER polkadot

EXPOSE 30333 9933 9944 9615
VOLUME ["/data"]

ENTRYPOINT ["/usr/local/bin/parachain-template-node"]
3 changes: 3 additions & 0 deletions templates/solochain/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
target/
Dockerfile
.dockerignore
28 changes: 28 additions & 0 deletions templates/solochain/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM docker.io/paritytech/ci-unified:latest as builder

WORKDIR /polkadot
COPY . /polkadot

RUN cargo fetch
RUN cargo build --locked --release

FROM docker.io/parity/base-bin:latest

COPY --from=builder /polkadot/target/release/solochain-template-node /usr/local/bin

USER root
RUN useradd -m -u 1001 -U -s /bin/sh -d /polkadot polkadot && \
mkdir -p /data /polkadot/.local/share && \
chown -R polkadot:polkadot /data && \
ln -s /data /polkadot/.local/share/polkadot && \
# unclutter and minimize the attack surface
rm -rf /usr/bin /usr/sbin && \
# check if executable works in this container
/usr/local/bin/solochain-template-node --version

USER polkadot

EXPOSE 30333 9933 9944 9615
VOLUME ["/data"]

ENTRYPOINT ["/usr/local/bin/solochain-template-node"]

0 comments on commit 52c4908

Please sign in to comment.