1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-11-09 20:00:12 +00:00

build: Update dockerfile for new Makefile

added a "precompile" step which takes the place of the "configuration
email swager..." stuff.
This commit is contained in:
Harvey Tindall 2024-08-06 20:34:28 +01:00
parent 2310130e6b
commit 790accc007
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
4 changed files with 8 additions and 10 deletions

View File

@ -1,6 +1,6 @@
# Use this instead if hrfee/jfa-go-build-docker doesn't support your architecture # Use this instead if hrfee/jfa-go-build-docker doesn't support your architecture
# FROM --platform=$BUILDPLATFORM golang:latest AS support # FROM --platform=$BUILDPLATFORM golang:latest AS support
FROM --platform=$BUILDPLATFORM hrfee/jfa-go-build-docker AS support FROM --platform=$BUILDPLATFORM docker.io/hrfee/jfa-go-build-docker:latest AS support
COPY . /opt/build COPY . /opt/build
@ -9,10 +9,10 @@ COPY . /opt/build
# && apt-get install build-essential python3-pip -y \ # && apt-get install build-essential python3-pip -y \
# && (curl -sL https://deb.nodesource.com/setup_current.x | bash -) \ # && (curl -sL https://deb.nodesource.com/setup_current.x | bash -) \
# && apt-get install nodejs # && apt-get install nodejs
RUN (cd /opt/build; make configuration npm email typescript variants-html bundle-css inline-css swagger copy INTERNAL=off GOESBUILD=on) \ RUN (cd /opt/build; npm i; make precompile INTERNAL=off GOESBUILD=on) \
&& sed -i 's#id="password_resets-watch_directory" placeholder="/config/jellyfin"#id="password_resets-watch_directory" value="/jf" disabled#g' /opt/build/build/data/html/setup.html && sed -i 's#id="password_resets-watch_directory" placeholder="/config/jellyfin"#id="password_resets-watch_directory" value="/jf" disabled#g' /opt/build/build/data/html/setup.html
FROM --platform=$BUILDPLATFORM golang:latest AS build FROM --platform=$BUILDPLATFORM docker.io/golang:latest AS build
ARG TARGETARCH ARG TARGETARCH
ENV GOARCH=$TARGETARCH ENV GOARCH=$TARGETARCH
ARG BUILT_BY ARG BUILT_BY
@ -30,5 +30,3 @@ EXPOSE 8056
EXPOSE 8057 EXPOSE 8057
CMD [ "/opt/jfa-go/jfa-go", "-data", "/data" ] CMD [ "/opt/jfa-go/jfa-go", "-data", "/data" ]

View File

@ -1,4 +1,4 @@
.PHONY: configuration email typescript swagger copy compile compress tailwind bundle-css inline-css variants-html install clean npm config-description config-default .PHONY: configuration email typescript swagger copy compile compress tailwind bundle-css inline-css variants-html install clean npm config-description config-default precompile
all: compile all: compile
@ -209,6 +209,8 @@ $(COPY_TARGET): $(INLINE_TARGET) $(STATIC_SRC)
cp -r lang $(DATA)/ cp -r lang $(DATA)/
cp LICENSE $(DATA)/ cp LICENSE $(DATA)/
precompile: $(CONFIG_DESCRIPTION) $(CONFIG_DEFAULT) $(EMAIL_TARGET) $(COPY_TARGET) $(SWAGGER_TARGET)
GO_SRC = $(shell find ./ -name "*.go") GO_SRC = $(shell find ./ -name "*.go")
GO_TARGET = build/jfa-go GO_TARGET = build/jfa-go
$(GO_TARGET): $(CONFIG_DESCRIPTION) $(CONFIG_DEFAULT) $(EMAIL_TARGET) $(COPY_TARGET) $(SWAGGER_TARGET) $(GO_SRC) go.mod go.sum $(GO_TARGET): $(CONFIG_DESCRIPTION) $(CONFIG_DEFAULT) $(EMAIL_TARGET) $(COPY_TARGET) $(SWAGGER_TARGET) $(GO_SRC) go.mod go.sum

View File

@ -499,7 +499,6 @@ func (app *appContext) DeleteUsers(gc *gin.Context) {
func (app *appContext) ExtendExpiry(gc *gin.Context) { func (app *appContext) ExtendExpiry(gc *gin.Context) {
var req extendExpiryDTO var req extendExpiryDTO
gc.BindJSON(&req) gc.BindJSON(&req)
app.info.Printf("Expiry extension requested for %d user(s)", len(req.Users))
if req.Months <= 0 && req.Days <= 0 && req.Hours <= 0 && req.Minutes <= 0 && req.Timestamp <= 0 { if req.Months <= 0 && req.Days <= 0 && req.Hours <= 0 && req.Minutes <= 0 && req.Timestamp <= 0 {
respondBool(400, false, gc) respondBool(400, false, gc)
return return

View File

@ -17,6 +17,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/golang-jwt/jwt" "github.com/golang-jwt/jwt"
"github.com/gomarkdown/markdown" "github.com/gomarkdown/markdown"
"github.com/hrfee/jfa-go/common"
lm "github.com/hrfee/jfa-go/logmessages" lm "github.com/hrfee/jfa-go/logmessages"
"github.com/hrfee/mediabrowser" "github.com/hrfee/mediabrowser"
"github.com/lithammer/shortuuid/v3" "github.com/lithammer/shortuuid/v3"
@ -538,9 +539,7 @@ func (app *appContext) verifyCaptcha(code, id, text string, isPWR bool) bool {
req.Header.Add("Content-Type", "application/x-www-form-urlencoded") req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
resp, err := http.DefaultClient.Do(req) resp, err := http.DefaultClient.Do(req)
if err == nil && resp.StatusCode != 200 { err = common.GenericErr(resp.StatusCode, err)
err = fmt.Errorf("failed (error %d)", resp.StatusCode)
}
if err != nil { if err != nil {
app.err.Printf(lm.FailedVerifyReCAPTCHA, err) app.err.Printf(lm.FailedVerifyReCAPTCHA, err)
return false return false