Add custom headscale dockerfile
This commit is contained in:
parent
ee64267e5a
commit
04992fc57d
2 changed files with 38 additions and 0 deletions
33
headscale/Dockerfile
Normal file
33
headscale/Dockerfile
Normal file
|
@ -0,0 +1,33 @@
|
|||
# Builder image
|
||||
FROM docker.io/golang:1.19.0-bullseye AS build
|
||||
ARG VERSION=v0.17.0-beta4
|
||||
ENV GOPATH /go
|
||||
|
||||
RUN apt-get install -y git && \
|
||||
git clone https://github.com/juanfont/headscale -b $VERSION /go/src/headscale
|
||||
|
||||
WORKDIR /go/src/headscale
|
||||
|
||||
RUN go mod download
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux go install -tags ts2019 -ldflags="-s -w -X github.com/juanfont/headscale/cmd/headscale/cli.Version=$VERSION" -a ./cmd/headscale
|
||||
RUN strip /go/bin/headscale
|
||||
RUN test -e /go/bin/headscale
|
||||
|
||||
# Production image
|
||||
# Note that we do not use "distroless" because we actually want to have a shell in the image
|
||||
# to run app.sh (in order to perform custom initialization)
|
||||
FROM docker.io/golang:1.19.0-bullseye
|
||||
|
||||
COPY --from=build /go/bin/headscale /bin/headscale
|
||||
ENV TZ UTC
|
||||
|
||||
ADD app.sh /
|
||||
|
||||
RUN chmod +x /app.sh
|
||||
|
||||
EXPOSE 8080/tcp
|
||||
# State path
|
||||
# Note that configuration should be mounted or added in /etc/headscale
|
||||
VOLUME /var/lib/headscale
|
||||
CMD ["/app.sh"]
|
5
headscale/app.sh
Normal file
5
headscale/app.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
touch /var/lib/headscale/db.sqlite
|
||||
mkdir /var/lib/headscale/.cache
|
||||
exec headscale -c /etc/headscale/config.yaml serve
|
Loading…
Add table
Reference in a new issue