diff --git a/.github/workflows/on-tag.yml b/.github/workflows/on-tag.yml index 53deac9..e6f6273 100644 --- a/.github/workflows/on-tag.yml +++ b/.github/workflows/on-tag.yml @@ -1,4 +1,4 @@ -name: Build & deploy lncm/ipfs on a git tag push +name: Build & deploy on git tag push on: push: diff --git a/README.md b/README.md index e69de29..66c9e32 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,152 @@ +lncm/docker-ipfs +================ + +![Build Status] +[![gh_last_release_svg]][gh_last_release_url] +[![Docker Image Size]][lnd-docker-hub] +[![Docker Pulls Count]][lnd-docker-hub] + +[Build Status]: https://github.com/lncm/docker-ipfs/workflows/Build%20%26%20deploy%20on%20git%20tag%20push/badge.svg + +[gh_last_release_svg]: https://img.shields.io/github/v/release/lncm/docker-ipfs?sort=semver +[gh_last_release_url]: https://github.com/lncm/docker-ipfs/releases/latest + +[Docker Image Size]: https://img.shields.io/microbadger/image-size/lncm/ipfs.svg +[Docker Pulls Count]: https://img.shields.io/docker/pulls/lncm/ipfs.svg?style=flat +[lnd-docker-hub]: https://hub.docker.com/r/lncm/ipfs + + +This repo builds [`go-ipfs`] in a completely reproducible, and auditable way, and packages it into radically minimal Docker containers provided for various CPU architectures. + +[`go-ipfs`]: https://github.com/ipfs/go-ipfs + +#### Details + +* **All [`git-tags`]** (and most commits) **are signed** by `D8CA1776EB9265491D07CE67F546ECBEA809CB18` +* **All [`git-tags`]** (and most commits) **are [`opentimestamps`]-ed** +* All built binaries should be reproducible +* Each build produces binaries for: `amd64`, `arm64v8`, `arm32v7`, and `arm32v6` +* Each version is provided in two flavors: + * `nofuse` (default) builds IPFS w/o [`fuse`] - only API/RPC/CLI communication is possible, but it requires zero extra config + * `fuse` builds IPFS with `fuse` support, and allows for mounting of `/ipfs/`, and `/ipns/` +* All architectures are aggregated under an easy-to-use [Docker Manifest] +* All [`git-tags`] are [build automatically], and with an [auditable trace] +* Each successful build of a `git tag` pushes result Docker image to [Docker Hub] +* Each successful build of a `git tag` uploads result Go binaries to [Github Releases] +* Images pushed to Docker Hub are never deleted (even if `lnd` version gets overriden, previous one is preserved) +* All `final` images are based on Alpine for minimum base size +* All binaries are [compressed with `upx`] +* Each `git-tag` build is tagged with a unique tag number + + +[`git-tags`]: https://github.com/lncm/docker-lnd/tags +[`opentimestamps`]: https://github.com/opentimestamps/opentimestamps-client/blob/master/doc/git-integration.md#usage +[`fuse`]: https://github.com/libfuse/libfuse +[Docker Manifest]: https://github.com/lncm/docker-ipfs/blob/a024916e70d2380c497a8c91865bcc964cb6a5f3/.github/workflows/on-tag.yml#L230-L264 +[build automatically]: https://github.com/lncm/docker-ipfs/blob/a024916e70d2380c497a8c91865bcc964cb6a5f3/.github/workflows/on-tag.yml +[auditable trace]: https://github.com/lncm/docker-ipfs/commit/a024916e70d2380c497a8c91865bcc964cb6a5f3/checks?check_suite_id=416190175 +[Docker Hub]: https://github.com/lncm/docker-ipfs/blob/a024916e70d2380c497a8c91865bcc964cb6a5f3/.github/workflows/on-tag.yml#L156-L264 +[Github Releases]: https://github.com/lncm/docker-ipfs/blob/a024916e70d2380c497a8c91865bcc964cb6a5f3/.github/workflows/on-tag.yml +[compressed with `upx`]: https://github.com/lncm/docker-ipfs/blob/a024916e70d2380c497a8c91865bcc964cb6a5f3/Dockerfile#L156-L160 + +## Tags + +> **NOTE:** For an always up-to-date list see: https://hub.docker.com/r/lncm/ipfs/tags + +* `latest` `nofuse` `v0.4.22` `v0.4` `v0.4.22-nofuse` `v0.4-nofuse` +* `fuse` `v0.4.22-fuse` `v0.4-fuse` +* `v0.4.21` + +## Usage + +### Pull + +First pull the image from [Docker Hub]: + +```bash +docker pull lncm/ipfs:v0.4.22 +``` + +> **NOTE:** Running above will automatically choose native architecture of your CPU. + +[Docker Hub]: https://hub.docker.com/r/lncm/ipfs + +Or, to pull a specific CPU architecture: + +```bash +docker pull lncm/ipfs:v0.4.22-fuse-arm64 +``` + +#### Start + +Then to start ipfs, execute: + +```bash +docker run -it --rm --detach \ + -v ~/.ipfs:/data/.ipfs \ + -p 4001:4001 \ + -p 5001:5001 \ + --name ipfs \ + lncm/ipfs:v0.4.22 +``` + +That will runs `ipfs` with: + +* all data generated by the container is stored in `~/.ipfs` **on your host machine**, +* all data is created as owned by used with `UID` `1000` +* port `4001` is reachable on the localhost for the peer-to-peer communication, +* control port `5001` is reachable on the localhost for RPC communication, +* created container will get named `ipfs`, +* that command will run the container in the background and print the ID of the container being run. + + +#### Start (w/fuse) + +Then to start ipfs, execute: + +```bash +docker run -it --rm \ + -v "~/.ipfs:/data/.ipfs" \ + -v "./ipfs:/ipfs/" \ + -v "./ipns:/ipns/" \ + -p 4001:4001 \ + -p 5001:5001 \ + --cap-add SYS_ADMIN \ + --device /dev/fuse:/dev/fuse:mrw \ + --name ipfs \ + lncm/ipfs:v0.4.22-fuse +``` + +That will runs `ipfs` with: + +* Extra permission granted is `SYS_ADMIN`, and container gains access to device `/dev/fuse` +* all data generated by the container is stored in `~/.ipfs` **on your host machine**, +* all file-system level data is in `./ipfs/`, and `./ipns/` in your current directory +* all data is created as owned by `root` +* port `4001` is reachable on the localhost for the peer-to-peer communication, +* control port `5001` is reachable on the localhost for RPC communication, +* created container will get named `ipfs`, +* that command will run the container in the background and print the ID of the container being run. + +#### Interact + +To issue any commands to a running container, do: + +```bash +docker exec -it ipfs BINARY COMMAND +``` + +Examples: + +```bash +docker exec -it ipfs ipfs --help +docker exec -it ipfs ipfs --version +docker exec -it ipfs ipfs id +docker exec -it ipfs ipfs swarm peers +docker exec -it ipfs ipfs stats bw +``` + + +## Releases + +After `git-tag` push, the release process is fully automated. That being said there are a few things that need to be done to prepare for the release. diff --git a/scripts/list-tags.sh b/scripts/list-tags.sh new file mode 100755 index 0000000..393f687 --- /dev/null +++ b/scripts/list-tags.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -eo pipefail + +# +## This script returns all lnd tags sorted newest to oldest, with all variants of the same version on the same line +# + +main() { + declare repo="$1" + + curl -s "https://registry.hub.docker.com/v1/repositories/${repo}/tags" \ + | jq -r '.[].name' \ + | grep '^v.*' \ + | sed 's/-build.*//' \ + | tr -s '-' '~' \ + | sort -Vr | uniq \ + | tr -s '~' '-' \ + | grep -v '\-\(arm32\|arm64\|amd64\|linux-arm\)' \ + | awk -F- '$1!=a && NR>1 {print "\n"}; {ORS=""; printf "`%s` ", $0}; {a=$1}' + + echo +} + +main "lncm/ipfs"