Community maintained Docker config for the knot server

update readme to reference the spindle and document how to build images using docker bake

psychedeli.ca 3cffdc73 dba8ae02

verified
+43 -14
+43 -14
readme.md
··· 4 4 > This is a community maintained repository, support is not guaranteed. 5 5 6 6 Docker container and compose setup to run a [Tangled](https://tangled.org) knot 7 - and host your own repository data. 7 + and spindle, hosting your own repository data and CI. 8 8 9 9 ## Pre-built Images 10 10 11 - There is a [repository](https://hub.docker.com/r/tngl/knot) of pre-built images 11 + There is a [repository](https://hub.docker.com/r/tngl) of pre-built images 12 12 for tags starting at `v1.8.0-alpha` if you prefer. 13 13 14 14 ``` 15 15 docker pull tngl/knot:v1.10.0-alpha 16 + docker pull tngl/spindle:v1.10.0-alpha 16 17 ``` 17 18 18 19 Note that these are *not* official images, you use them at your own risk. 19 20 20 - ## Building The Image 21 + ## Building The Images 22 + 23 + Both the knot and spindle images are built using the same `Dockerfile`, since 24 + they're sourced from the same codebase and can therefore share a lot of the 25 + build steps (such as `go mod download`), caching results between them. You 26 + can build the images locally by running `docker bake`: 27 + 28 + ```sh 29 + docker bake 30 + ``` 31 + 32 + Optionally, choose a target image to build: 33 + 34 + ```sh 35 + docker bake knot 36 + docker bake spindle 37 + ``` 21 38 22 39 By default the `Dockerfile` will build the latest tag, but you can change it 23 40 with the `TAG` build argument. 24 41 25 42 ```sh 26 - docker build -t knot:latest --build-arg TAG=master . 43 + docker bake --build-arg TAG=v1.10.0-alpha 27 44 ``` 28 45 29 - The command above for example will build the latest commit on the `master` 30 - branch. 46 + The command above for example will build the `v1.10.0-alpha` tag. 31 47 32 - By default it will also create a `git` user with user and group ID 1000:1000, 48 + By default it will also create a `git` / `spindle` user with user and group ID 1000:1000, 33 49 but you can change it with the `UID` and `GID` build arguments. 34 50 35 51 ```sh 36 - docker build -t knot:latest --build-arg UID=$(id -u) GID=$(id -g) 52 + docker bake --build-arg UID=$(id -u) --build-arg GID=$(id -g) 37 53 ``` 38 54 39 55 The command above for example will create a user with the host user's UID and GID. 40 56 This is useful if you are bind mounting the repositories and app folder on the host, 41 57 as in the provided `docker-compose.yml` file. 58 + 59 + You can also build the latest commit on `master` for both services by using 60 + the `-edge` targets. These will build to a tag named `:edge` to distinguish 61 + it from the `:latest` release: 62 + 63 + ```sh 64 + docker bake edge 65 + # or, with a specific target image 66 + docker bake edge-knot 67 + docker bake edge-spindle 68 + ``` 42 69 43 70 <hr style="margin-bottom: 20px; margin-top: 10px" /> 44 71 ··· 59 86 60 87 ## Setting Up The Image 61 88 62 - The simplest way to set up your own knot is to use the provided compose file 63 - and run the following: 89 + The simplest way to set up your own knot and spindle is to use the provided 90 + compose file and run the following: 64 91 65 92 ```sh 66 - export KNOT_SERVER_HOSTNAME=example.com 67 - export KNOT_SERVER_OWNER=did:plc:yourdidgoeshere 68 - export KNOT_SERVER_PORT=443 69 - docker compose up -d 93 + export KNOT_SERVER_HOSTNAME="knot.example.com" 94 + export SPINDLE_SERVER_HOSTNAME="spindle.example.com" 95 + export KNOT_SERVER_OWNER="did:plc:yourdidgoeshere" 96 + export KNOT_SERVER_PORT="443" 97 + 98 + docker compose up --detach 70 99 ``` 71 100 72 101 This will setup everything for you including a reverse proxy.