Add Dockerfile

- Add Docker image
- Fix whitespace location in the footer when version is not provided
- Add log message when the server is about to start

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2025-08-22 07:57:08 +02:00
parent d9c6d7905f
commit 4b75edc754
Signed by: jriou
GPG key ID: 9A099EDA51316854
3 changed files with 19 additions and 2 deletions

16
Dockerfile Normal file
View file

@ -0,0 +1,16 @@
FROM golang:1.24-bookworm AS builder
RUN apt-get update && apt-get install -y libx11-dev && apt-get clean
COPY . /usr/app
COPY .git/ /usr/app/.git
WORKDIR /usr/app
RUN make
FROM debian:12 AS final
COPY --from=builder /usr/app/bin/collerd /usr/local/bin/collerd
COPY --from=builder /usr/app/bin/coller /usr/local/bin/coller
COPY --from=builder /usr/app/bin/copier /usr/local/bin/copier
CMD ["collerd"]

View file

@ -347,5 +347,6 @@ func (s *Server) Start() error {
r.Path("/").Handler(&HomeHandler{Templates: templates, PageData: p}).Methods("GET")
addr := fmt.Sprintf("%s:%d", s.config.ListenAddress, s.config.ListenPort)
s.logger.Info(fmt.Sprintf("listening to %s:%d", s.config.ListenAddress, s.config.ListenPort))
return http.ListenAndServe(addr, r)
}

View file

@ -1,5 +1,5 @@
{{define "footer"}}
<footer class="text-center">
<small>Powered by <a href="https://git.riou.xyz/jriou/coller">coller</a> {{if ne .Version ``}}({{.Version}}){{end}}</small>
<small>Powered by <a href="https://git.riou.xyz/jriou/coller">coller</a>{{if ne .Version ``}} ({{.Version}}){{end}}</small>
</footer>
{{end}}
{{end}}