Alter 3 files

Add .gitlab-ci.yml
Add Dockerfile
Add README.md
This commit is contained in:
akp 2025-01-05 23:16:58 +00:00
commit 2065e67f60
No known key found for this signature in database
GPG key ID: CF8D58F3DEB20755
3 changed files with 51 additions and 0 deletions

20
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,20 @@
workflow:
rules:
- if: '$CI_COMMIT_TAG'
stages:
- build
default:
image: docker
services:
- docker:dind
buildAndPush:
stage: build
before_script:
- "echo $CI_REGISTRY_PASSWORD | docker login $CI_REGISTRY --username $CI_REGISTRY_USER --password-stdin"
- "docker info"
script:
- "docker build . --file Dockerfile --tag ${CI_REGISTRY_IMAGE}:latest --tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG#'v'}" # that weird thing #'v' thing strips a prefix of v
- "docker push --all-tags $CI_REGISTRY_IMAGE"

17
Dockerfile Normal file
View file

@ -0,0 +1,17 @@
FROM golang:1.23 AS builder
RUN mkdir /build
WORKDIR /build
RUN git clone --branch=release-2.5 https://github.com/arp242/goatcounter.git .
RUN go build -ldflags="-X zgo.at/goatcounter/v2.Version=$(git log -n1 --format='%h_%cI')" ./cmd/goatcounter
FROM debian
RUN mkdir -p /usr/bin
COPY --from=builder /build/goatcounter /usr/bin
RUN mkdir -p /run/goatcounter
WORKDIR /run/goatcounter
ENTRYPOINT ["goatcounter"]

14
README.md Normal file
View file

@ -0,0 +1,14 @@
# docker-goatcounter
This is a very simple Docker wrapper around [Goatcounter](https://github.com/arp242/goatcounter), for ease of deployment.
It must be configured exactly as normal through the command line (there are no environment variables). By default, the working directory within the container is `/run/goatcounter`.
A good example of how to use this image would be:
```
docker run \
-p 127.0.0.1:8080:8080 \
-v $(pwd):/run/goatcounter \
registry.git.tdpain.net serve -listen :8080 -db 'sqlite+goatcounter.sqlite3.db' -tls proxy
```