mirror of
https://git.maid.zone/stuff/soundcloak.git
synced 2025-12-10 13:49:39 +05:00
cache /_/info marshaled data; restructure dockerfile
This commit is contained in:
12
Dockerfile
12
Dockerfile
@@ -5,22 +5,22 @@ ARG TARGETOS
|
|||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# fuck google
|
# fuck google
|
||||||
RUN go env -w GOPROXY=direct
|
RUN go env -w GOPROXY=direct
|
||||||
|
|
||||||
RUN go install github.com/a-h/templ/cmd/templ@latest
|
RUN go install github.com/a-h/templ/cmd/templ@latest
|
||||||
RUN templ generate
|
|
||||||
|
|
||||||
RUN go install github.com/dlclark/regexp2cg@main
|
RUN go install github.com/dlclark/regexp2cg@main
|
||||||
RUN go generate ./lib/*
|
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
# usually soundcloakctl updates together with soundcloak, so we should redownload it
|
||||||
RUN go install git.maid.zone/stuff/soundcloakctl@master
|
RUN go install git.maid.zone/stuff/soundcloakctl@master
|
||||||
RUN soundcloakctl config codegen
|
|
||||||
# this downloads JS modules (currently only hls.js) from jsdelivr and stores them locally for serving
|
|
||||||
RUN soundcloakctl js download
|
RUN soundcloakctl js download
|
||||||
|
|
||||||
|
RUN templ generate
|
||||||
|
RUN go generate ./lib/*
|
||||||
|
RUN soundcloakctl config codegen
|
||||||
|
|
||||||
RUN CGO_ENABLED=0 GOARCH=${TARGETARCH} GOOS=${TARGETOS} go build -ldflags "-s -w -extldflags '-static'" -o ./app
|
RUN CGO_ENABLED=0 GOARCH=${TARGETARCH} GOOS=${TARGETOS} go build -ldflags "-s -w -extldflags '-static'" -o ./app
|
||||||
RUN echo "soundcloak:x:5000:5000:Soundcloak user:/:/sbin/nologin" > /etc/minimal-passwd && \
|
RUN echo "soundcloak:x:5000:5000:Soundcloak user:/:/sbin/nologin" > /etc/minimal-passwd && \
|
||||||
echo "soundcloak:x:5000:" > /etc/minimal-group
|
echo "soundcloak:x:5000:" > /etc/minimal-group
|
||||||
|
|||||||
10
main.go
10
main.go
@@ -340,8 +340,7 @@ func main() {
|
|||||||
DefaultPreferences cfg.Preferences
|
DefaultPreferences cfg.Preferences
|
||||||
}
|
}
|
||||||
|
|
||||||
app.Get("/_/info", func(c *fiber.Ctx) error {
|
inf, err := json.Marshal(info{
|
||||||
return c.JSON(info{
|
|
||||||
Commit: cfg.Commit,
|
Commit: cfg.Commit,
|
||||||
Repo: cfg.Repo,
|
Repo: cfg.Repo,
|
||||||
ProxyImages: cfg.ProxyImages,
|
ProxyImages: cfg.ProxyImages,
|
||||||
@@ -350,6 +349,13 @@ func main() {
|
|||||||
GetWebProfiles: cfg.GetWebProfiles,
|
GetWebProfiles: cfg.GetWebProfiles,
|
||||||
DefaultPreferences: cfg.DefaultPreferences,
|
DefaultPreferences: cfg.DefaultPreferences,
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalln("failed to marshal info: ", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
app.Get("/_/info", func(c *fiber.Ctx) error {
|
||||||
|
c.Set("Content-Type", "application/json")
|
||||||
|
return c.Send(inf)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user