Skip to content

Commit

Permalink
Migrate to polkadot-sdk monorepo (#14)
Browse files Browse the repository at this point in the history
* Migrate to `polkadot-sdk` monorepo

* Polkadot migrated to a monorepo
* Update Dockerfile to use the new monorepo
* Update Readme to reflect this
* Don't build all branches
* Don't cache everything

* Bump docker/metadata-action from 4 to 5

Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 4 to 5.
- [Release notes](https://github.com/docker/metadata-action/releases)
- [Upgrade guide](https://github.com/docker/metadata-action/blob/master/UPGRADE.md)
- [Commits](docker/metadata-action@v4...v5)

---
updated-dependencies:
- dependency-name: docker/metadata-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump docker/setup-qemu-action from 2 to 3

Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](docker/setup-qemu-action@v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump docker/login-action from 2 to 3

Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](docker/login-action@v2...v3)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump docker/setup-buildx-action from 2 to 3

Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](docker/setup-buildx-action@v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump docker/build-push-action from 4 to 5

Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4 to 5.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](docker/build-push-action@v4...v5)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
rblaine95 and dependabot[bot] authored Sep 13, 2023
1 parent eb5d725 commit f142499
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 27 deletions.
31 changes: 20 additions & 11 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
name: Docker

on: [workflow_dispatch, push]
on:
workflow_dispatch:
push:
branches:
- master
tags:
- v*
pull_request:
branches:
- master

jobs:
build:
Expand All @@ -11,15 +20,15 @@ jobs:
- arch: amd64
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
platforms: linux/${{ matrix.arch }}
push: false
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha
context: .
package:
needs: [build]
Expand All @@ -29,14 +38,14 @@ jobs:
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v2
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/metadata-action@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/polkadot
Expand All @@ -46,12 +55,12 @@ jobs:
type=ref,event=pr
type=semver,pattern={{version}}
- name: Package and Push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha
context: .
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
###################
# --- builder --- #
###################
FROM docker.io/rust:1.71 AS builder
FROM docker.io/rust:1.72 AS builder

RUN apt-get update && \
apt-get -y dist-upgrade && \
Expand All @@ -11,20 +11,20 @@ RUN apt-get update && \
protobuf-compiler

WORKDIR /opt
ARG VERSION=1.0.0
RUN git clone https://github.com/paritytech/polkadot.git -b v$VERSION --depth 1
WORKDIR /opt/polkadot
ARG VERSION=polkadot-v1.1.0
RUN git clone https://github.com/paritytech/polkadot-sdk.git -b $VERSION --depth 1
WORKDIR /opt/polkadot-sdk
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
RUN ./scripts/init.sh
RUN ./polkadot/scripts/init.sh
RUN rustup target add wasm32-unknown-unknown
RUN cargo build --release
RUN cargo build --release --package polkadot

##################
# --- runner --- #
##################
FROM docker.io/debian:12-slim

COPY --from=builder /opt/polkadot/target/release/polkadot /usr/local/bin/polkadot
COPY --from=builder /opt/polkadot-sdk/target/release/polkadot /usr/local/bin/polkadot

RUN addgroup --gid 65532 nonroot \
&& adduser --system --uid 65532 --gid 65532 --home /home/nonroot nonroot
Expand Down
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Docker Polkadot
My personal unprivileged Polkadot Docker image.
My personal unprivileged Polkadot Docker image.

[![Github tag (latest by date)][github-tag-badge]][github-tag-link]

[![Github tag (latest by date)][github-tag-badge]][github-tag-link]
[![GitHub Workflow Status (branch)][github-actions-badge]][github-actions-link]

Usage:
Expand All @@ -17,25 +18,29 @@ docker run \
```

### Nonroot
The nonroot user has a U/GID of `65532`.
If you are having IO permission issues then make sure that the persistent volume has permissions set to allow this user Read/Write access.
The nonroot user has a U/GID of `65532`.

If you are having IO permission issues then make sure that the persistent volume has permissions set to allow this user Read/Write access.

If using [Podman](https://podman.io/) - `podman unshare chown -R 65532:65532 /path/to/polkadot/storage`

### Where can I download the image?
I'm using Github Actions to build and publish this image to:
* [ghcr.io/rblaine95/polkadot](https://ghcr.io/rblaine95/polkadot)

### I want to buy you a coffee
This is just a hobby project for me, if you really want to buy me a coffee, thank you :)
This is just a hobby project for me, if you really want to buy me a coffee, thank you :)

Monero: `83TeC9hCsZjjUcvNVH6VD64FySQ2uTbgw6ETfzNJa51sJaM6XL4NParSNsKqEQN4znfpbtVj84smigtLBtT1AW6BTVQVQGh`

Monero: `83TeC9hCsZjjUcvNVH6VD64FySQ2uTbgw6ETfzNJa51sJaM6XL4NParSNsKqEQN4znfpbtVj84smigtLBtT1AW6BTVQVQGh`
![XMR Address](https://api.qrserver.com/v1/create-qr-code/?data=83TeC9hCsZjjUcvNVH6VD64FySQ2uTbgw6ETfzNJa51sJaM6XL4NParSNsKqEQN4znfpbtVj84smigtLBtT1AW6BTVQVQGh&amp;size=150x150 "83TeC9hCsZjjUcvNVH6VD64FySQ2uTbgw6ETfzNJa51sJaM6XL4NParSNsKqEQN4znfpbtVj84smigtLBtT1AW6BTVQVQGh")

### I don't have Polkadot
You should read their [Lightpaper](https://polkadot.network/Polkadot-lightpaper.pdf) and check it out!
* [paritytech/polkadot](https://github.com/paritytech/polkadot)
* [Polkadot.Network](https://polkadot.network/)
* [/r/polkadot](https://www.reddit.com/r/polkadot)
* [paritytech/polkadot](https://github.com/paritytech/polkadot) (_archived_)
* [paritytech/polkadot-sdk](https://github.com/paritytech/polkadot-sdk)
* [Polkadot.Network](https://polkadot.network/)
* [/r/polkadot](https://www.reddit.com/r/polkadot)
* [/r/dot](https://www.reddit.com/r/dot)


Expand Down

0 comments on commit f142499

Please sign in to comment.