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

Commit

Permalink
Flag files to be deleted and changes to be done
Browse files Browse the repository at this point in the history
  • Loading branch information
chevdor committed Aug 2, 2023
1 parent 6a546da commit 850dd21
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 26 deletions.
35 changes: 23 additions & 12 deletions scripts/ci/dockerfiles/binary_injected.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# It would be better using this image to inject generic binaries
# instead of requiring a dockerfile per binary.
# Unfortunately, ENTRYPOINT requires using an ENV
# and the current setup shows limitation: the passed args are ignored.

FROM docker.io/parity/base-bin

# This file allows building a Generic container image
# based on one or multiple pre-built Linux binaries.
# Some defaults are set to polkadot but all can be overriden.


# metadata
ARG VCS_REF
ARG BUILD_DATE
Expand All @@ -13,32 +13,43 @@ ARG BINARY=polkadot
ARG BIN_FOLDER=.
ARG DOC_URL=https://github.com/paritytech/polkadot
ARG DESCRIPTION="Polkadot: a platform for web3"
ARG AUTHORS="[email protected]"
ARG VENDOR="Parity Technologies"

LABEL io.parity.image.authors="[email protected]" \
io.parity.image.vendor="Parity Technologies" \
io.parity.image.title="${IMAGE_NAME}" \
io.parity.image.description="${DESCRIPTION}" \
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/ci/dockerfiles/binary_injected.Dockerfile" \
LABEL io.parity.image.authors=${AUTHORS} \
io.parity.image.vendor="${VENDOR}" \
io.parity.image.revision="${VCS_REF}" \
io.parity.image.title="${IMAGE_NAME}" \
io.parity.image.created="${BUILD_DATE}" \
io.parity.image.documentation="${DOC_URL}"
io.parity.image.documentation="${DOC_URL}" \
io.parity.image.description="${DESCRIPTION}" \
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/ci/dockerfiles/binary_injected.Dockerfile"

USER root
WORKDIR /app

# add polkadot binary to docker image
# sample for polkadot: COPY ./polkadot ./polkadot-*-worker /usr/local/bin/
COPY entrypoint.sh .
COPY ./$BIN_FOLDER/$BINARY /usr/local/bin/
RUN chmod a+rwx /usr/local/bin/$BINARY

USER parity
ENV BINARY=${BINARY}

# check if executable works in this container
# check that all the executables works in this container
# TODO: There may be several
RUN /usr/local/bin/$BINARY --version

# TODO: change that, we may have multiple BINARIES
# TODO: we need a VAR for VOLUMES
VOLUME ["/$BINARY"]

# TODO: we need a VAR for PORTS
# EXPOSE 30333 9933 9944 9615

# ENTRYPOINT
ENTRYPOINT ["/app/entrypoint.sh"]

# We call the help by default
CMD ["--help"]
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ RUN apt-get update && \


# add malus binary to docker image
COPY ./malus ./polkadot-execute-worker ./polkadot-prepare-worker /usr/local/bin
COPY ./malus ./polkadot-execute-worker ./polkadot-prepare-worker /usr/local/bin/

USER nonroot

Expand Down
13 changes: 6 additions & 7 deletions scripts/ci/dockerfiles/polkadot/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
version: '3'
services:
polkadot:
image: parity/polkadot:latest

ports:
- "127.0.0.1:30333:30333/tcp"
- "127.0.0.1:9933:9933/tcp"
image: parity/polkadot:latest
- "127.0.0.1:9944:9944/tcp"
- "127.0.0.1:9615:9615/tcp"

volumes:
- "polkadot-data:/data"

command: |
--unsafe-rpc-external
--unsafe-ws-external
--rpc-cors all
--prometheus-external
ports:
- "30333:30333"
- "9933:9933"
- "9944:9944"
- "9615:9615"

volumes:
polkadot-data:
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ COPY . /polkadot
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
FROM docker.io/parity/base-bin:latest

LABEL description="Multistage Docker image for Polkadot: a platform for web3" \
io.parity.image.type="builder" \
Expand Down
8 changes: 4 additions & 4 deletions scripts/ci/gitlab/pipeline/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ publish-polkadot-debug-image:
GIT_STRATEGY: none
DOCKER_USER: ${PARITYPR_USER}
DOCKER_PASS: ${PARITYPR_PASS}
# scripts/ci/dockerfiles/polkadot_injected.Dockerfile
# TODO: The image below must be switched to ci/dockerfiles/binary_injected.Dockerfile
DOCKERFILE: ci/dockerfiles/polkadot_injected.Dockerfile
IMAGE_NAME: docker.io/paritypr/polkadot-debug
needs:
Expand Down Expand Up @@ -52,7 +52,7 @@ publish-test-collators-image:
GIT_STRATEGY: none
DOCKER_USER: ${PARITYPR_USER}
DOCKER_PASS: ${PARITYPR_PASS}
# scripts/ci/dockerfiles/collator_injected.Dockerfile
# TODO: Switch to scripts/ci/dockerfiles/binary_injected.Dockerfile
DOCKERFILE: ci/dockerfiles/collator_injected.Dockerfile
IMAGE_NAME: docker.io/paritypr/colander
needs:
Expand Down Expand Up @@ -80,7 +80,7 @@ publish-malus-image:
GIT_STRATEGY: none
DOCKER_USER: ${PARITYPR_USER}
DOCKER_PASS: ${PARITYPR_PASS}
# scripts/ci/dockerfiles/malus_injected.Dockerfile
# TODO: Switch to scripts/ci/dockerfiles/binary_injected.Dockerfile
DOCKERFILE: ci/dockerfiles/malus_injected.Dockerfile
IMAGE_NAME: docker.io/paritypr/malus
needs:
Expand All @@ -104,7 +104,7 @@ publish-staking-miner-image:
- .publish-refs
variables:
CI_IMAGE: ${BUILDAH_IMAGE}
# scripts/ci/dockerfiles/staking-miner/staking-miner_injected.Dockerfile
# TODO: Switch to scripts/ci/dockerfiles/binary_injected.Dockerfile
DOCKERFILE: ci/dockerfiles/staking-miner/staking-miner_injected.Dockerfile
IMAGE_NAME: docker.io/paritytech/staking-miner
GIT_STRATEGY: none
Expand Down
4 changes: 3 additions & 1 deletion utils/staking-miner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ There are 2 options to build a staking-miner Docker image:
### Building the injected image

First build the binary as documented [above](#building).
You may then inject the binary into a Docker base image from the root of the Polkadot repository:
You may then inject the binary into a Docker base image: `parity/base-bin` (running the command from the root of the Polkadot repository):
```
TODO: UPDATE THAT
docker build -t staking-miner -f scripts/ci/dockerfiles/staking-miner/staking-miner_injected.Dockerfile target/release
```

Expand All @@ -39,6 +40,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:
```
TODO: UPDATE THAT
docker build -t staking-miner -f scripts/ci/dockerfiles/staking-miner/staking-miner_builder.Dockerfile .
```

Expand Down

0 comments on commit 850dd21

Please sign in to comment.