Compare commits

..

3 Commits

Author SHA1 Message Date
f9e3d41c62 fix dockerfile COPY 2024-03-05 10:30:21 +01:00
895707036a fix warning 2024-03-05 10:26:17 +01:00
2124d9af00 add dockerfile, update libs 2024-03-05 10:25:55 +01:00
4 changed files with 28 additions and 12 deletions

16
dockerfile Normal file
View File

@@ -0,0 +1,16 @@
FROM golang:1.22.0-alpine3.19 as build
COPY . /src
RUN cd /src \
&& go build -o retrohub \
&& mkdir -p ./fs/var/opt/retrohub \
&& mkdir -p ./fs/opt/retrohub \
&& cp retrohub ./fs/opt/retrohub/retrohub
FROM scratch as prod
COPY --from=build --chmod=755 /src/fs /
EXPOSE 8080
ENTRYPOINT [ "/opt/retrohub/retrohub", "-content", "/var/opt/retrohub/content.json" ]

6
go.mod
View File

@@ -1,8 +1,8 @@
module retroHub module retroHub
go 1.20 go 1.22
require ( require (
github.com/go-chi/chi/v5 v5.0.8 github.com/go-chi/chi/v5 v5.0.12
github.com/mileusna/useragent v1.3.2 github.com/mileusna/useragent v1.3.4
) )

8
go.sum
View File

@@ -1,4 +1,4 @@
github.com/go-chi/chi/v5 v5.0.8 h1:lD+NLqFcAi1ovnVZpsnObHGW4xb4J8lNmoYVfECH1Y0= github.com/go-chi/chi/v5 v5.0.12 h1:9euLV5sTrTNTRUU9POmDUvfxyj6LAABLUcEWO+JJb4s=
github.com/go-chi/chi/v5 v5.0.8/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-chi/chi/v5 v5.0.12/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/mileusna/useragent v1.3.2 h1:yGBQVNkyrlnSe4l0rlaQoH8XlG9xDkc6a7ygwPxALoU= github.com/mileusna/useragent v1.3.4 h1:MiuRRuvGjEie1+yZHO88UBYg8YBC/ddF6T7F56i3PCk=
github.com/mileusna/useragent v1.3.2/go.mod h1:3d8TOmwL/5I8pJjyVDteHtgDGcefrFUX4ccGOMKNYYc= github.com/mileusna/useragent v1.3.4/go.mod h1:3d8TOmwL/5I8pJjyVDteHtgDGcefrFUX4ccGOMKNYYc=

View File

@@ -2,18 +2,18 @@ package server
import ( import (
"embed" "embed"
_ "embed"
"errors" "errors"
"fmt" "fmt"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"github.com/mileusna/useragent"
"html/template" "html/template"
"log" "log"
"net/http" "net/http"
"os" "os"
"retroHub/data" "retroHub/data"
"strings" "strings"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"github.com/mileusna/useragent"
) )
type injector struct { type injector struct {
@@ -36,7 +36,7 @@ type errorInjector struct {
StatusText string StatusText string
} }
const version string = "0.1" const version string = "0.1.1"
//go:embed templates //go:embed templates
var templates embed.FS var templates embed.FS