Community maintained Docker config for the knot server
92
fork

Configure Feed

Select the types of activity you want to include in your feed.

build(docker): automatically use latest tag #1

open opened by anhgelus.world targeting main

This patch automatically downloads latest tagged version. With this, we don't have to update the previous TAG arguments to update the image. We can override the version download with the argument VERSION.

if [ "${VERSION}" = "" ]; then export VERSION=$(git -c versionsort.suffix=- ls-remote --sort='v:refname' --tags --refs ${REPO} | tail -n1 | sed 's/.*tags\///'); fi

is the code responsible to determine the version. If $VERSION is empty, it fetches every tag with git-ls-remote(1), get the last one with tail(1) and select the good part with sed(1). If $VERSION is not empty, it does nothing.

See https://stackoverflow.com/questions/10649814/get-last-git-tag-from-a-remote-repo-without-cloning for more information.

Labels

None yet.

Participants 1
AT URI
at://did:plc:vtqucb4iga7b5wzza3zbz4so/sh.tangled.repo.pull/3mkaewigwhi22
+10 -3
Diff #0
+10 -3
Dockerfile
··· 2 2 env KNOT_REPO_SCAN_PATH=/home/git/repositories 3 3 env CGO_ENABLED=1 4 4 5 - arg TAG='v1.13.0-alpha' 5 + # set it if you want to build a specific version 6 + arg VERSION="" 7 + arg REPO=https://tangled.org/tangled.org/core 6 8 7 9 workdir /app 8 10 run apk add git gcc musl-dev 9 - run git clone -b ${TAG} https://tangled.org/@tangled.org/core . 11 + # This command determines the latest tagged version if VERSION is empty. 12 + # See https://stackoverflow.com/questions/10649814/get-last-git-tag-from-a-remote-repo-without-cloning for more 13 + # infromation. 14 + # Then, it clones the repo. 15 + run if [ "${VERSION}" = "" ]; then export VERSION=$(git -c versionsort.suffix=- ls-remote --sort='v:refname' --tags --refs ${REPO} | tail -n1 | sed 's/.*tags\///'); fi && \ 16 + git clone -b ${VERSION} ${REPO} . 10 17 run go build -o /usr/bin/knot -ldflags '-s -w -extldflags "-static"' ./cmd/knot 11 18 12 19 from alpine:latest ··· 15 22 16 23 label org.opencontainers.image.title='knot' 17 24 label org.opencontainers.image.description='data server for tangled' 18 - label org.opencontainers.image.source='https://tangled.org/@tangled.org/knot-docker' 25 + label org.opencontainers.image.source='${REPO}' 19 26 label org.opencontainers.image.url='https://tangled.org' 20 27 label org.opencontainers.image.vendor='tangled.org' 21 28 label org.opencontainers.image.licenses='MIT'

History

1 round 0 comments
sign up or login to add to the discussion
anhgelus.world submitted #0
1 commit
expand
e19d825b
build(docker): automatically use latest tag
merge conflicts detected
expand
  • Dockerfile:2
expand 0 comments