Skip to content

Commit 0125bf1

Browse files
committed
Add README & list tags script
1 parent a024916 commit 0125bf1

File tree

3 files changed

+178
-1
lines changed

3 files changed

+178
-1
lines changed

.github/workflows/on-tag.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build & deploy lncm/ipfs on a git tag push
1+
name: Build & deploy on git tag push
22

33
on:
44
push:

README.md

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
lncm/docker-ipfs
2+
================
3+
4+
![Build Status]
5+
[![gh_last_release_svg]][gh_last_release_url]
6+
[![Docker Image Size]][lnd-docker-hub]
7+
[![Docker Pulls Count]][lnd-docker-hub]
8+
9+
[Build Status]: https://github.com/lncm/docker-ipfs/workflows/Build%20%26%20deploy%20on%20git%20tag%20push/badge.svg
10+
11+
[gh_last_release_svg]: https://img.shields.io/github/v/release/lncm/docker-ipfs?sort=semver
12+
[gh_last_release_url]: https://github.com/lncm/docker-ipfs/releases/latest
13+
14+
[Docker Image Size]: https://img.shields.io/microbadger/image-size/lncm/ipfs.svg
15+
[Docker Pulls Count]: https://img.shields.io/docker/pulls/lncm/ipfs.svg?style=flat
16+
[lnd-docker-hub]: https://hub.docker.com/r/lncm/ipfs
17+
18+
19+
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.
20+
21+
[`go-ipfs`]: https://github.com/ipfs/go-ipfs
22+
23+
#### Details
24+
25+
* **All [`git-tags`]** <small>(and most commits)</small> **are signed** by `D8CA1776EB9265491D07CE67F546ECBEA809CB18`
26+
* **All [`git-tags`]** <small>(and most commits)</small> **are [`opentimestamps`]-ed**
27+
* All built binaries should be reproducible
28+
* Each build produces binaries for: `amd64`, `arm64v8`, `arm32v7`, and `arm32v6`
29+
* Each version is provided in two flavors:
30+
* `nofuse` (default) builds IPFS w/o [`fuse`] - only API/RPC/CLI communication is possible, but it requires zero extra config
31+
* `fuse` builds IPFS with `fuse` support, and allows for mounting of `/ipfs/`, and `/ipns/`
32+
* All architectures are aggregated under an easy-to-use [Docker Manifest]
33+
* All [`git-tags`] are [build automatically], and with an [auditable trace]
34+
* Each successful build of a `git tag` pushes result Docker image to [Docker Hub]
35+
* Each successful build of a `git tag` uploads result Go binaries to [Github Releases]
36+
* Images pushed to Docker Hub are never deleted (even if `lnd` version gets overriden, previous one is preserved)
37+
* All `final` images are based on Alpine for minimum base size
38+
* All binaries are [compressed with `upx`]
39+
* Each `git-tag` build is tagged with a unique tag number
40+
41+
42+
[`git-tags`]: https://github.com/lncm/docker-lnd/tags
43+
[`opentimestamps`]: https://github.com/opentimestamps/opentimestamps-client/blob/master/doc/git-integration.md#usage
44+
[`fuse`]: https://github.com/libfuse/libfuse
45+
[Docker Manifest]: https://github.com/lncm/docker-ipfs/blob/a024916e70d2380c497a8c91865bcc964cb6a5f3/.github/workflows/on-tag.yml#L230-L264
46+
[build automatically]: https://github.com/lncm/docker-ipfs/blob/a024916e70d2380c497a8c91865bcc964cb6a5f3/.github/workflows/on-tag.yml
47+
[auditable trace]: https://github.com/lncm/docker-ipfs/commit/a024916e70d2380c497a8c91865bcc964cb6a5f3/checks?check_suite_id=416190175
48+
[Docker Hub]: https://github.com/lncm/docker-ipfs/blob/a024916e70d2380c497a8c91865bcc964cb6a5f3/.github/workflows/on-tag.yml#L156-L264
49+
[Github Releases]: https://github.com/lncm/docker-ipfs/blob/a024916e70d2380c497a8c91865bcc964cb6a5f3/.github/workflows/on-tag.yml
50+
[compressed with `upx`]: https://github.com/lncm/docker-ipfs/blob/a024916e70d2380c497a8c91865bcc964cb6a5f3/Dockerfile#L156-L160
51+
52+
## Tags
53+
54+
> **NOTE:** For an always up-to-date list see: https://hub.docker.com/r/lncm/ipfs/tags
55+
56+
* `latest` `nofuse` `v0.4.22` `v0.4` `v0.4.22-nofuse` `v0.4-nofuse`
57+
* `fuse` `v0.4.22-fuse` `v0.4-fuse`
58+
* `v0.4.21`
59+
60+
## Usage
61+
62+
### Pull
63+
64+
First pull the image from [Docker Hub]:
65+
66+
```bash
67+
docker pull lncm/ipfs:v0.4.22
68+
```
69+
70+
> **NOTE:** Running above will automatically choose native architecture of your CPU.
71+
72+
[Docker Hub]: https://hub.docker.com/r/lncm/ipfs
73+
74+
Or, to pull a specific CPU architecture:
75+
76+
```bash
77+
docker pull lncm/ipfs:v0.4.22-fuse-arm64
78+
```
79+
80+
#### Start
81+
82+
Then to start ipfs, execute:
83+
84+
```bash
85+
docker run -it --rm --detach \
86+
-v ~/.ipfs:/data/.ipfs \
87+
-p 4001:4001 \
88+
-p 5001:5001 \
89+
--name ipfs \
90+
lncm/ipfs:v0.4.22
91+
```
92+
93+
That will runs `ipfs` with:
94+
95+
* all data generated by the container is stored in `~/.ipfs` **on your host machine**,
96+
* all data is created as owned by used with `UID` `1000`
97+
* port `4001` is reachable on the localhost for the peer-to-peer communication,
98+
* control port `5001` is reachable on the localhost for RPC communication,
99+
* created container will get named `ipfs`,
100+
* that command will run the container in the background and print the ID of the container being run.
101+
102+
103+
#### Start (w/fuse)
104+
105+
Then to start ipfs, execute:
106+
107+
```bash
108+
docker run -it --rm \
109+
-v "~/.ipfs:/data/.ipfs" \
110+
-v "./ipfs:/ipfs/" \
111+
-v "./ipns:/ipns/" \
112+
-p 4001:4001 \
113+
-p 5001:5001 \
114+
--cap-add SYS_ADMIN \
115+
--device /dev/fuse:/dev/fuse:mrw \
116+
--name ipfs \
117+
lncm/ipfs:v0.4.22-fuse
118+
```
119+
120+
That will runs `ipfs` with:
121+
122+
* Extra permission granted is `SYS_ADMIN`, and container gains access to device `/dev/fuse`
123+
* all data generated by the container is stored in `~/.ipfs` **on your host machine**,
124+
* all file-system level data is in `./ipfs/`, and `./ipns/` in your current directory
125+
* all data is created as owned by `root`
126+
* port `4001` is reachable on the localhost for the peer-to-peer communication,
127+
* control port `5001` is reachable on the localhost for RPC communication,
128+
* created container will get named `ipfs`,
129+
* that command will run the container in the background and print the ID of the container being run.
130+
131+
#### Interact
132+
133+
To issue any commands to a running container, do:
134+
135+
```bash
136+
docker exec -it ipfs BINARY COMMAND
137+
```
138+
139+
Examples:
140+
141+
```bash
142+
docker exec -it ipfs ipfs --help
143+
docker exec -it ipfs ipfs --version
144+
docker exec -it ipfs ipfs id
145+
docker exec -it ipfs ipfs swarm peers
146+
docker exec -it ipfs ipfs stats bw
147+
```
148+
149+
150+
## Releases
151+
152+
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.

scripts/list-tags.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
3+
set -eo pipefail
4+
5+
#
6+
## This script returns all lnd tags sorted newest to oldest, with all variants of the same version on the same line
7+
#
8+
9+
main() {
10+
declare repo="$1"
11+
12+
curl -s "https://registry.hub.docker.com/v1/repositories/${repo}/tags" \
13+
| jq -r '.[].name' \
14+
| grep '^v.*' \
15+
| sed 's/-build.*//' \
16+
| tr -s '-' '~' \
17+
| sort -Vr | uniq \
18+
| tr -s '~' '-' \
19+
| grep -v '\-\(arm32\|arm64\|amd64\|linux-arm\)' \
20+
| awk -F- '$1!=a && NR>1 {print "\n"}; {ORS=""; printf "`%s` ", $0}; {a=$1}'
21+
22+
echo
23+
}
24+
25+
main "lncm/ipfs"

0 commit comments

Comments
 (0)