Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Docker files chore #3880

Merged
merged 26 commits into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4e55208
Renamed staking-miner Dockerfiles
alvicsam Sep 17, 2021
977a241
change readme stacking-miner
alvicsam Sep 17, 2021
546e6e9
mv docker/ to scripts/docker/polkadot
alvicsam Sep 17, 2021
ccc229d
renamed dockerfiles in scripts/docker
alvicsam Sep 17, 2021
b88a80e
renamed Dockerfiles
alvicsam Sep 21, 2021
23c5c9d
Update scripts/docker/staking-miner/staking_miner_injected.Dockerfile
alvicsam Sep 22, 2021
eb9a162
renamed release.Dockerfile
alvicsam Sep 22, 2021
5e759af
renamed staking-miner dockerfiles
alvicsam Sep 23, 2021
91afb7e
add label polkadot_builder.Dockerfile
alvicsam Sep 23, 2021
95b2f9e
Update scripts/docker/polkadot/polkadot_builder.Dockerfile
alvicsam Sep 23, 2021
af8f2b2
Update scripts/docker/polkadot/polkadot_builder.Dockerfile
alvicsam Sep 23, 2021
77843b4
Update scripts/docker/polkadot/polkadot_builder.Dockerfile
alvicsam Sep 23, 2021
78546fe
Update scripts/docker/polkadot/polkadot_builder.Dockerfile
alvicsam Sep 23, 2021
75c4041
Update scripts/docker/polkadot_injected_release.Dockerfile
alvicsam Sep 23, 2021
c92cf8e
Update scripts/docker/collator_injected.Dockerfile
alvicsam Sep 23, 2021
bde4005
Update scripts/docker/staking-miner/staking-miner_injected.Dockerfile
alvicsam Sep 23, 2021
d0f3b09
Update scripts/docker/staking-miner/staking-miner_builder.Dockerfile
alvicsam Sep 23, 2021
f74a965
Update scripts/docker/staking-miner/staking-miner_builder.Dockerfile
alvicsam Sep 23, 2021
a38854f
Update scripts/docker/staking-miner/staking-miner_injected.Dockerfile
alvicsam Sep 23, 2021
fadc1fa
move gpg server as variable to GHA config
alvicsam Sep 23, 2021
f5e84fa
simplified polkadot_builder.Dockerfile
alvicsam Sep 24, 2021
df1d25b
gitlab-ci modify cp command in test-build-linux-stable
alvicsam Sep 27, 2021
8864054
fix tests
alvicsam Sep 27, 2021
89b08e1
renamed scripts/docker to scripts/dockerfiles
alvicsam Sep 28, 2021
4407296
fix spellcheck
alvicsam Sep 28, 2021
eda4c65
fix spellcheck
alvicsam Sep 28, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/publish-docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ jobs:
uses: docker/build-push-action@v2
with:
push: true
file: scripts/docker/release.Dockerfile
file: scripts/docker/polkadot_injected_release.Dockerfile
tags: |
parity/polkadot:latest
parity/polkadot:${{ github.event.release.tag_name }}
build-args: |
POLKADOT_VERSION=${{ github.event.release.tag_name }}
VCS_REF=${{ github.ref }}
BUILD_DATE=${{ github.event.release.published_at }}
GPG_KEYSERVER="hkps://keys.mailvelope.com"
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Image digest
Expand Down
12 changes: 6 additions & 6 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ test-build-linux-stable:
- echo "Polkadot version = ${VERSION} (EXTRATAG = ${EXTRATAG})"
- echo -n ${VERSION} > ./artifacts/VERSION
- echo -n ${EXTRATAG} > ./artifacts/EXTRATAG
- cp -r scripts/docker/* ./artifacts
- cp -r scripts/* ./artifacts

check-runtime-benchmarks:
stage: test
Expand Down Expand Up @@ -265,7 +265,7 @@ build-adder-collator:
- echo -n "${CI_COMMIT_REF_NAME}" > ./artifacts/VERSION
- echo -n "${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}" > ./artifacts/EXTRATAG
- echo "adder-collator version = $(cat ./artifacts/VERSION) (EXTRATAG = $(cat ./artifacts/EXTRATAG))"
- cp -r scripts/docker/* ./artifacts
- cp -r scripts/* ./artifacts

#### stage: build

Expand Down Expand Up @@ -358,8 +358,8 @@ publish-polkadot-image:
<<: *build-push-image
variables:
<<: *image-variables
# scripts/docker/Dockerfile
DOCKERFILE: Dockerfile
# scripts/dockerfiles/polkadot_injected_debug.Dockerfile
DOCKERFILE: dockerfiles/polkadot_injected_debug.Dockerfile
IMAGE_NAME: docker.io/paritypr/synth-wave
rules:
# Don't run on releases - this is handled by the Github Action here:
Expand Down Expand Up @@ -394,8 +394,8 @@ publish-adder-collator-image:
<<: *build-push-image
variables:
<<: *image-variables
# scripts/docker/collator.Dockerfile
DOCKERFILE: collator.Dockerfile
# scripts/dockerfiles/collator_injected.Dockerfile
DOCKERFILE: dockerfiles/collator_injected.Dockerfile
IMAGE_NAME: docker.io/paritypr/colander
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
Expand Down
8 changes: 4 additions & 4 deletions doc/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

The easiest/faster option to run Polkadot in Docker is to use the latest release images. These are small images that use the latest official release of the Polkadot binary, pulled from our package repository.

**_Following examples are running on westend chain and without SSL. They can be used to quick start and learn how Polkadot needs to be configured. Please find out how to secure your node, if you want to operate it on the internet. Do not expose rpc and ws ports, if they are not correctly configured._**
**_Following examples are running on westend chain and without SSL. They can be used to quick start and learn how Polkadot needs to be configured. Please find out how to secure your node, if you want to operate it on the internet. Do not expose RPC and WS ports, if they are not correctly configured._**

Let´s first check the version we have. The first time you run this command, the Polkadot docker image will be downloaded. This takes a bit of time and bandwidth, be patient:
Let's first check the version we have. The first time you run this command, the Polkadot docker image will be downloaded. This takes a bit of time and bandwidth, be patient:

```bash
docker run --rm -it parity/polkadot:latest --version
Expand Down Expand Up @@ -65,7 +65,7 @@ services:
]
```

With following docker-compose.yml you can set up a node and use polkadot-js-apps as the front end on port 80. After starting the node use a browser and enter your Docker host ip in the url field: _<http://[YOUR_DOCKER_HOST_IP>_
With following docker-compose.yml you can set up a node and use polkadot-js-apps as the front end on port 80. After starting the node use a browser and enter your Docker host IP in the URL field: _<http://[YOUR_DOCKER_HOST_IP>_

```bash
version: '2'
Expand Down Expand Up @@ -118,7 +118,7 @@ To get up and running with the smallest footprint on your system, you may use th
You can build it yourself (it takes a while...) in the shell session of the daemon:

```bash
cd docker
cd scripts/docker/polkadot
./build.sh
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ ARG IMAGE_NAME
LABEL io.parity.image.authors="devops-team@parity.io" \
io.parity.image.vendor="Parity Technologies" \
io.parity.image.title="${IMAGE_NAME}" \
io.parity.image.description="adder-collator image" \
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/docker/collator.Dockerfile" \
io.parity.image.description="Injected adder-collator Docker image" \
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/docker/collator_injected.Dockerfile" \
io.parity.image.revision="${VCS_REF}" \
io.parity.image.created="${BUILD_DATE}" \
io.parity.image.documentation="https://github.com/paritytech/polkadot/"
Expand All @@ -22,8 +22,7 @@ ENV RUST_BACKTRACE 1
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
libssl1.1 \
ca-certificates \
curl && \
ca-certificates && \
# apt cleanup
apt-get autoremove -y && \
apt-get clean && \
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docker/build.sh → scripts/dockerfiles/polkadot/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ GITREPO=polkadot

# Build the image
echo "Building ${GITUSER}/${GITREPO}:latest docker image, hang on!"
time docker build -f ./docker/Dockerfile --build-arg RUSTC_WRAPPER= --build-arg PROFILE=release -t ${GITUSER}/${GITREPO}:latest .
time docker build -f ./scripts/docker/polkadot/polkadot_builder.Dockerfile --build-arg RUSTC_WRAPPER= --build-arg PROFILE=release -t ${GITUSER}/${GITREPO}:latest .

# Show the list of available images for this repo
echo "Image is ready"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ services:
node_alice:
build:
context: .
dockerfile: polkadot_builder.Dockerfile
ports:
- "30333:30333"
- "9933:9933"
Expand All @@ -18,6 +19,7 @@ services:
node_bob:
build:
context: .
dockerfile: polkadot_builder.Dockerfile
ports:
- "30344:30344"
- "9935:9935"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ services:
polkadot:
build:
context: .
dockerfile: polkadot_builder.Dockerfile
ports:
- "127.0.0.1:30333:30333/tcp"
- "127.0.0.1:9933:9933/tcp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
FROM docker.io/paritytech/ci-linux:production as builder
LABEL description="This is the build stage for Polkadot. Here we create the binary."
LABEL io.parity.image.description="This is the build stage for Polkadot. Here we create the binary."

ARG PROFILE=release
WORKDIR /polkadot

COPY . /polkadot

RUN cargo build --$PROFILE
RUN cargo build --release --locked

# ===== SECOND STAGE ======

FROM docker.io/library/ubuntu:20.04
LABEL description="This is the 2nd stage: a very small image where we copy the Polkadot binary."
ARG PROFILE=release
COPY --from=builder /polkadot/target/$PROFILE/polkadot /usr/local/bin
LABEL io.parity.image.description="Polkadot: a platform for web3. This is a self-buit multistage image."

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 && \
Expand All @@ -23,7 +22,7 @@ RUN useradd -m -u 1000 -U -s /bin/sh -d /polkadot polkadot && \
rm -rf /usr/bin /usr/sbin

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

CMD ["/usr/local/bin/polkadot"]
ENTRYPOINT ["/usr/local/bin/polkadot"]
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LABEL io.parity.image.authors="devops-team@parity.io" \
io.parity.image.vendor="Parity Technologies" \
io.parity.image.title="${IMAGE_NAME}" \
io.parity.image.description="Polkadot: a platform for web3" \
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/docker/Dockerfile" \
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/docker/polkadot_injected_debug.Dockerfile" \
io.parity.image.revision="${VCS_REF}" \
io.parity.image.created="${BUILD_DATE}" \
io.parity.image.documentation="https://github.com/paritytech/polkadot/"
Expand All @@ -21,8 +21,7 @@ ENV RUST_BACKTRACE 1
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
libssl1.1 \
ca-certificates \
curl && \
ca-certificates && \
# apt cleanup
apt-get autoremove -y && \
apt-get clean && \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ FROM docker.io/library/ubuntu:20.04
ARG VCS_REF
ARG BUILD_DATE
ARG POLKADOT_VERSION
ARG POLKADOT_GPGKEY=9D4B2B6EB8F97156D19669A9FF0812D491B96798
ARG GPG_KEYSERVER="hkps://keys.mailvelope.com"

LABEL io.parity.image.authors="devops-team@parity.io" \
io.parity.image.vendor="Parity Technologies" \
io.parity.image.title="parity/polkadot" \
io.parity.image.description="Polkadot: a platform for web3" \
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/docker/Dockerfile" \
io.parity.image.description="Polkadot: a platform for web3. This is the official Parity image with an injected binary." \
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/docker/polkadot_injected_release.Dockerfile" \
io.parity.image.revision="${VCS_REF}" \
io.parity.image.created="${BUILD_DATE}" \
io.parity.image.documentation="https://github.com/paritytech/polkadot/"
Expand All @@ -22,12 +24,11 @@ RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
libssl1.1 \
ca-certificates \
curl \
gnupg && \
useradd -m -u 1000 -U -s /bin/sh -d /polkadot polkadot && \
# add repo's gpg keys and install the published polkadot binary
gpg --recv-keys --keyserver hkps://keys.mailvelope.com 9D4B2B6EB8F97156D19669A9FF0812D491B96798 && \
gpg --export 9D4B2B6EB8F97156D19669A9FF0812D491B96798 > /usr/share/keyrings/parity.gpg && \
gpg --recv-keys --keyserver ${GPG_KEYSERVER} ${POLKADOT_GPGKEY} && \
gpg --export ${POLKADOT_GPGKEY} > /usr/share/keyrings/parity.gpg && \
echo 'deb [signed-by=/usr/share/keyrings/parity.gpg] https://releases.parity.io/deb release main' > /etc/apt/sources.list.d/parity.list && \
apt-get update && \
apt-get install -y --no-install-recommends polkadot=${POLKADOT_VERSION#?} && \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ LABEL description="This is the 2nd stage: a very small image where we copy the b
LABEL io.parity.image.authors="devops-team@parity.io" \
io.parity.image.vendor="Parity Technologies" \
io.parity.image.title="${IMAGE_NAME}" \
io.parity.image.description="staking-miner for substrate based chains" \
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/docker/staking-miner/staking_miner-builder.Dockerfile" \
io.parity.image.description="${IMAGE_NAME} for substrate based chains" \
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/docker/${IMAGE_NAME}/${IMAGE_NAME}_builder.Dockerfile" \
io.parity.image.revision="${VCS_REF}" \
io.parity.image.created="${BUILD_DATE}" \
io.parity.image.documentation="https://github.com/paritytech/polkadot/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ ARG IMAGE_NAME="staking-miner"
LABEL io.parity.image.authors="devops-team@parity.io" \
io.parity.image.vendor="Parity Technologies" \
io.parity.image.title="${IMAGE_NAME}" \
io.parity.image.description="staking-miner for substrate based chains" \
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/docker/staking-miner/staking_miner-injected.Dockerfile" \
io.parity.image.description="${IMAGE_NAME} for substrate based chains" \
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/docker/${IMAGE_NAME}/${IMAGE_NAME}_injected.Dockerfile" \
io.parity.image.revision="${VCS_REF}" \
io.parity.image.created="${BUILD_DATE}" \
io.parity.image.documentation="https://github.com/paritytech/polkadot/"
Expand Down
5 changes: 5 additions & 0 deletions scripts/gitlab/lingua.dic
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ proxy/G
proxying
PRs
PVF/S
p2p
README/MS
redhat/M
register/CD
Expand Down Expand Up @@ -226,6 +227,7 @@ Simnet/MS
spawn/SR
spawner
sr25519
SSL
startup/MS
stateful
str
Expand Down Expand Up @@ -281,6 +283,7 @@ versa
version/DMSG
versioned
VMP/SM
VPS
VRF/SM
w3f/MS
wakeups
Expand All @@ -291,9 +294,11 @@ Westend/M
wildcard/MS
WND/S
Wococo
WS
XCM/S
XCMP/M
yeet
yml
decrement
DM
ParaId
4 changes: 2 additions & 2 deletions utils/staking-miner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ There are 2 options to build a staking-miner Docker image:
First build the binary as documented [above](#building).
You may then inject the binary into a Docker base image usingfrom the root of the Polkadot repository:
```
docker build -t staking-miner -f scripts/docker/staking-miner/staking_miner-injected.Dockerfile target/release
docker build -t staking-miner -f scripts/docker/staking-miner/staking-miner_injected.Dockerfile target/release
```

### Building the multi-stage image
Expand All @@ -39,7 +39,7 @@ Unlike the injected image that requires a Linux pre-built binary, this option do
The trade-off however is that it takes a little longer to build and this option is less ideal for CI tasks.
You may build the multi-stage image the root of the Polkadot repository with:
```
docker build -t staking-miner -f scripts/docker/staking-miner/staking_miner-builder.Dockerfile .
docker build -t staking-miner -f scripts/docker/staking-miner/staking-miner_builder.Dockerfile .
```

### Running
Expand Down