Community maintained Docker config for the knot server

Add Spindle container image build #12

open opened by psychedeli.ca targeting main from psychedeli.ca/knot-docker: spindle

This PR adds tngl/spindle as a new image, using the same Dockerfile as the Knot server but in an additional stage of the build. By building the images from the same Dockerfile, we can re-use the clone from a single tag and cache more artifacts between builds. It also introduces a docker bake workflow and a docker-bake.hcl file to describe images built off the master branch and given the :edge tag (which is an emerging convention in container tag nomenclature).

The build succeeded, but I got a bunch of warnings about inconsistent case (my editor was yelling at me when it encountered lowercase Dockerfile instructions):

 24 warnings found (use docker --debug to expand):
 - ConsistentInstructionCasing: Command 'CMD' should match the case of the command majority (lowercase) (line 66)
 - ConsistentInstructionCasing: Command 'FROM' should match the case of the command majority (lowercase) (line 10)
 - ConsistentInstructionCasing: Command 'FROM' should match the case of the command majority (lowercase) (line 13)
 - ConsistentInstructionCasing: Command 'ARG' should match the case of the command majority (lowercase) (line 57)
 - ConsistentInstructionCasing: Command 'COPY' should match the case of the command majority (lowercase) (line 63)
 - FromAsCasing: 'AS' and 'from' keywords' casing do not match (line 16)
 - ConsistentInstructionCasing: Command 'RUN' should match the case of the command majority (lowercase) (line 11)
 - ConsistentInstructionCasing: Command 'LABEL' should match the case of the command majority (lowercase) (line 49)
 - ConsistentInstructionCasing: Command 'LABEL' should match the case of the command majority (lowercase) (line 52)
 - ConsistentInstructionCasing: Command 'LABEL' should match the case of the command majority (lowercase) (line 53)
 - ConsistentInstructionCasing: Command 'RUN' should match the case of the command majority (lowercase) (line 61)
 - ConsistentInstructionCasing: Command 'WORKDIR' should match the case of the command majority (lowercase) (line 65)
 - ConsistentInstructionCasing: Command 'RUN' should match the case of the command majority (lowercase) (line 14)
 - ConsistentInstructionCasing: Command 'FROM' should match the case of the command majority (lowercase) (line 46)
 - ConsistentInstructionCasing: Command 'EXPOSE' should match the case of the command majority (lowercase) (line 47)
 - ConsistentInstructionCasing: Command 'LABEL' should match the case of the command majority (lowercase) (line 50)
 - ConsistentInstructionCasing: Command 'ARG' should match the case of the command majority (lowercase) (line 56)
 - ConsistentInstructionCasing: Command 'RUN' should match the case of the command majority (lowercase) (line 59)
 - ConsistentInstructionCasing: Command 'VOLUME' should match the case of the command majority (lowercase) (line 67)
 - ConsistentInstructionCasing: Command 'HEALTHCHECK' should match the case of the command majority (lowercase) (line 68)
 - ConsistentInstructionCasing: Command 'ENV' should match the case of the command majority (lowercase) (line 17)
 - ConsistentInstructionCasing: Command 'LABEL' should match the case of the command majority (lowercase) (line 51)
 - ConsistentInstructionCasing: Command 'LABEL' should match the case of the command majority (lowercase) (line 54)
 - ConsistentInstructionCasing: Command 'RUN' should match the case of the command majority (lowercase) (line 60)

...so I was wondering if I could commit this other change that formats the Dockerfile properly? But I figured I'd let y'all see the changes first before they're obfuscated by all that reformatting.

Labels

None yet.

Participants 3
AT URI
at://did:plc:cmla2he5nqvubofxm4pzgtyi/sh.tangled.repo.pull/3m6bb2zk52i22
+15 -18
Interdiff #1 β†’ #2
Dockerfile

This patch was likely rebased, as context lines do not match.

+14 -17
docker-bake.hcl
··· 1 variable "UID" { 2 default = "1000" 3 } 4 5 variable "GID" { 6 default = "1000" 7 } 8 9 - group "edge" { 10 - targets = ["knot-edge", "spindle-edge"] 11 - } 12 - 13 - target "knot-edge" { 14 context = "." 15 - target = "knot" 16 - args = { 17 - TAG = "master" 18 - UID = UID 19 - GID = GID 20 } 21 - tags = ["tngl/knot:edge"] 22 - } 23 - 24 - target "spindle-edge" { 25 - context = "." 26 - target = "spindle" 27 args = { 28 TAG = "master" 29 UID = UID 30 GID = GID 31 } 32 - tags = ["tngl/spindle:edge"] 33 } 34 35 target "all" { 36 name = "${APP}-${replace(TAG, ".", "-")}" 37 context = "."
··· 1 variable "UID" { 2 default = "1000" 3 + description = "User ID for the git and spindle users" 4 } 5 6 variable "GID" { 7 default = "1000" 8 + description = "Group ID for the git and spindle users" 9 } 10 11 + # 12 + # Build the latest commit from the master branch 13 + # 14 + target "edge" { 15 + name = "${APP}-edge" 16 context = "." 17 + target = "${APP}" 18 + matrix = { 19 + APP = ["knot", "spindle"] 20 } 21 args = { 22 TAG = "master" 23 UID = UID 24 GID = GID 25 } 26 + tags = ["tngl/${APP}:edge"] 27 } 28 29 + # 30 + # Build supported legacy releases 31 + # 32 target "all" { 33 name = "${APP}-${replace(TAG, ".", "-")}" 34 context = "."
docker-compose.yml

This file has not been changed.

+1 -1
readme.md
··· 11 There is a [repository](https://hub.docker.com/r/tngl) of pre-built images 12 for tags starting at `v1.8.0-alpha` if you prefer. 13 14 - ``` 15 docker pull tngl/knot:v1.10.0-alpha 16 docker pull tngl/spindle:v1.10.0-alpha 17 ```
··· 11 There is a [repository](https://hub.docker.com/r/tngl) of pre-built images 12 for tags starting at `v1.8.0-alpha` if you prefer. 13 14 + ```sh 15 docker pull tngl/knot:v1.10.0-alpha 16 docker pull tngl/spindle:v1.10.0-alpha 17 ```

History

3 rounds 4 comments
sign up or login to add to the discussion
8 commits
expand
add build stage for the spindle server
add spindle to docker-compose and configure builds for each image
add docker bake config for building edge releases
update readme to reference the spindle and document how to build images using docker bake
fix adduser/group commands in spindle stage
add legacy releases task and info on how to build past releases
rename releases to all
add docs around variables
merge conflicts detected
expand
  • Dockerfile:1
expand 0 comments
8 commits
expand
add build stage for the spindle server
bump tag to v1.11.0 in Dockerfile
add spindle to docker-compose and configure builds for each image
add docker bake config for building edge releases
update readme to reference the spindle and document how to build images using docker bake
fix adduser/group commands in spindle stage
add legacy releases task and info on how to build past releases
rename releases to all
expand 4 comments

Why not simply using a very simple Dockerfile, like this one for instance: https://tangled.org/strings/julien.rbrt.fr/3m75vdbmdad22

It's unclear to me why this would be built into the knot docker repo. Not all knot hosters will want to host spindles.

@julien.rbrt.fr all the dependencies and build commands are the same between the two tangled components so sharing their stages between builds makes building both of those programs faster.

@knotbin.com do you feel like the spindle image would be better off built in a different repo? my only reason for PRing here is so both the knot & spindle builds could take advantage of some dependency and artifact caching due to the multi-stage dockerfile. but if it’s better off in a different repo that’s fine too.

i concur, I think this should be fine to merge once conflicts are fixed.

6 commits
expand
add build stage for the spindle server
bump tag to v1.11.0 in Dockerfile
add spindle to docker-compose and configure builds for each image
add docker bake config for building edge releases
update readme to reference the spindle and document how to build images using docker bake
fix adduser/group commands in spindle stage
expand 0 comments