forked from arp242/goatcounter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (27 loc) · 886 Bytes
/
Copy pathDockerfile
File metadata and controls
32 lines (27 loc) · 886 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# syntax=docker/dockerfile:1-labs
# Use -labs for copy --exclude
### Build GoatCounter
from docker.io/golang:latest as build
workdir /goatcounter
copy --exclude=goatcounter-data --exclude=Dockerfile . /goatcounter
env CGO_ENABLED=1
env GOTOOLCHAIN=auto
run go build -trimpath -ldflags='-s -w -extldflags=-static' \
-tags='osusergo,netgo,sqlite_omit_load_extension' \
./cmd/goatcounter
### Build container
from docker.io/alpine
copy --from=build /goatcounter/goatcounter /bin/goatcounter
run <<EOF
set -euC
addgroup goatcounter
adduser -DG goatcounter goatcounter
mkdir /home/goatcounter/goatcounter-data
chown goatcounter:goatcounter /home/goatcounter/goatcounter-data
EOF
expose 80 443 8080
workdir /home/goatcounter
user goatcounter:goatcounter
volume ["/home/goatcounter/goatcounter-data"]
entrypoint ["goatcounter"]
cmd ["serve", "-automigrate"]