Unverified Commit 4870e7bc authored by Chevdor's avatar Chevdor Committed by GitHub
Browse files

chore: update `builder` image (#3884)



* chore: update `builder` image

fix #9765

* fix: fix binary path

* chore: refresh of the builder image + build script

* Fix port

* Fix image source

* Update scripts/dockerfiles/polkadot/polkadot_builder.Dockerfile
Co-authored-by: Denis_P's avatarDenis Pisarev <denis.pisarev@parity.io>
parent 1a923915
Pipeline #160506 passed with stages
in 39 minutes and 7 seconds
......@@ -8,19 +8,17 @@ PROJECT_ROOT=`git rev-parse --show-toplevel`
cd $PROJECT_ROOT
# Find the current version from Cargo.toml
VERSION=`grep "^version" ./Cargo.toml | egrep -o "([0-9\.]+)"`
VERSION=`grep "^version" ./cli/Cargo.toml | egrep -o "([0-9\.]+)"`
GITUSER=parity
GITREPO=polkadot
# Build the image
echo "Building ${GITUSER}/${GITREPO}:latest docker image, hang on!"
time docker build -f ./scripts/docker/polkadot/polkadot_builder.Dockerfile --build-arg RUSTC_WRAPPER= --build-arg PROFILE=release -t ${GITUSER}/${GITREPO}:latest .
time docker build -f ./scripts/dockerfiles/polkadot/polkadot_builder.Dockerfile -t ${GITUSER}/${GITREPO}:latest .
docker tag ${GITUSER}/${GITREPO}:latest ${GITUSER}/${GITREPO}:v${VERSION}
# Show the list of available images for this repo
echo "Image is ready"
docker images | grep ${GITREPO}
echo -e "\nIf you just built version ${VERSION}, you may want to update your tag:"
echo " $ docker tag ${GITUSER}/${GITREPO}:$VERSION ${GITUSER}/${GITREPO}:${VERSION}"
popd
version: '3'
services:
node_alice:
build:
context: .
dockerfile: polkadot_builder.Dockerfile
ports:
- "30333:30333"
- "9933:9933"
- "9944:9944"
image: chevdor/polkadot:latest
- "9615:9615"
image: parity/polkadot:latest
volumes:
- "polkadot-data-alice:/data"
command: polkadot --chain=polkadot-local --alice -d /data --node-key 0000000000000000000000000000000000000000000000000000000000000001
command: |
--chain=polkadot-local
--alice
-d /data
--node-key 0000000000000000000000000000000000000000000000000000000000000001
networks:
testing_net:
ipv4_address: 172.28.1.1
node_bob:
build:
context: .
dockerfile: polkadot_builder.Dockerfile
ports:
- "30344:30344"
- "9935:9935"
- "9945:9945"
image: chevdor/polkadot:latest
- "30344:30333"
- "9935:9933"
- "9945:9944"
- "29615:9615"
image: parity/polkadot:latest
volumes:
- "polkadot-data-bob:/data"
links:
- "node_alice:alice"
command: polkadot --chain=polkadot-local --bob -d /data --port 30344 --rpc-port 9935 --ws-port 9945 --bootnodes '/ip4/172.28.1.1/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR'
command: |
--chain=polkadot-local
--bob
-d /data
--bootnodes '/ip4/172.28.1.1/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR'
networks:
testing_net:
ipv4_address: 172.28.1.2
......
version: '3'
services:
polkadot:
build:
context: .
dockerfile: polkadot_builder.Dockerfile
ports:
- "127.0.0.1:30333:30333/tcp"
- "127.0.0.1:9933:9933/tcp"
image: chevdor/polkadot:latest
image: parity/polkadot:latest
volumes:
- "polkadot-data:/data"
command: polkadot
command: |
--unsafe-rpc-external
--unsafe-ws-external
--rpc-cors all
--prometheus-external
ports:
- "30333:30333"
- "9933:9933"
- "9944:9944"
- "9615:9615"
volumes:
polkadot-data:
# This is the build stage for Polkadot. Here we create the binary in a temporary image.
FROM docker.io/paritytech/ci-linux:production as builder
LABEL io.parity.image.description="This is the build stage for Polkadot. Here we create the binary."
WORKDIR /polkadot
COPY . /polkadot
RUN cargo build --release --locked
# ===== SECOND STAGE ======
RUN cargo build --locked --release
# This is the 2nd stage: a very small image where we copy the Polkadot binary."
FROM docker.io/library/ubuntu:20.04
LABEL io.parity.image.description="Polkadot: a platform for web3. This is a self-buit multistage image."
LABEL description="Multistage Docker image for Polkadot: a platform for web3" \
io.parity.image.type="builder" \
io.parity.image.authors="chevdor@gmail.com, devops-team@parity.io" \
io.parity.image.vendor="Parity Technologies" \
io.parity.image.description="Polkadot: a platform for web3" \
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/dockerfiles/polkadot/polkadot_builder.Dockerfile" \
io.parity.image.documentation="https://github.com/paritytech/polkadot/"
COPY --from=builder /polkadot/target/release/polkadot /usr/local/bin
RUN useradd -m -u 1000 -U -s /bin/sh -d /polkadot polkadot && \
mkdir -p /polkadot/.local/share && \
mkdir /data && \
mkdir -p /data /polkadot/.local/share && \
chown -R polkadot:polkadot /data && \
ln -s /data /polkadot/.local/share/polkadot && \
rm -rf /usr/bin /usr/sbin
# unclutter and minimize the attack surface
rm -rf /usr/bin /usr/sbin && \
# check if executable works in this container
/usr/local/bin/polkadot --version
USER polkadot
EXPOSE 30333 9933 9944 9615
VOLUME ["/data"]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment