↳
In-reply-to
»
@bender I built my own, a much smaller one with a multi stage build... shouldn't that do the trick? 🤔
⤋ Read More
@bender@twtxt.net here:
FROM golang:alpine as builder
ARG version
ENV HTWTXT_VERSION=$version
WORKDIR $GOPATH/pkg/
RUN wget -O htwtxt.tar.gz https://github.com/plomlompom/htwtxt/archive/refs/tags/${HTWTXT_VERSION}.tar.gz
RUN tar xf htwtxt.tar.gz && cd htwtxt-${HTWTXT_VERSION} && go mod init htwtxt && go mod tidy && go install htwtxt
FROM alpine
ARG version
ENV HTWTXT_VERSION=$version
RUN mkdir -p /srv/htwtxt
COPY --from=builder /go/bin/htwtxt /usr/bin/
COPY --from=builder /go/pkg/htwtxt-${HTWTXT_VERSION}/templates/* /srv/htwtxt/templates/
WORKDIR /srv/htwtxt
VOLUME /srv/htwtxt
EXPOSE 8000
ENTRYPOINT ["htwtxt", "-dir", "/srv/htwtxt", "-templates", "/srv/htwtxt/templates"]
Don’t forget the --build-arg version="1.0.7"
for example when building this one, although there isn’t much difference between the couple last versions.
P.S: I may have effed up changing htwtxt’s files directory to /srv/htwtxt
when the command itself defaults to /root/htwtxt
so you’ll have to throw in a -dir whenever you issue an htwtxt command (i.e: htwtxt -adduser somename:somepwd -dir /srv/htwtxt
… etc)