diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 8d46488..c98914c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,5 +1,5 @@ name: ci -on: [push] +on: [push, pull_request] jobs: build: diff --git a/src/gossa.go b/src/gossa.go index e1e078f..f4d1904 100755 --- a/src/gossa.go +++ b/src/gossa.go @@ -68,6 +68,7 @@ func hash(s string) string { func exitPath(w http.ResponseWriter, s ...interface{}) { if r := recover(); r != nil { log.Println("error", s, r) + w.WriteHeader(500) w.Write([]byte("error")) } else if *verb { log.Println(s...) diff --git a/support/build.Dockerfile b/support/build.Dockerfile index dc1f21c..de6f990 100644 --- a/support/build.Dockerfile +++ b/support/build.Dockerfile @@ -3,6 +3,9 @@ COPY . /gossaSrc RUN cd /gossaSrc && make FROM alpine +ENV UID="1000" GID="1000" HOST="0.0.0.0" PORT="8001" PREFIX="/" FOLLOW_SYMLINKS="false" SKIP_HIDDEN_FILES="true" DATADIR="/shared" EXPOSE 8001 +RUN apk add --no-cache su-exec COPY --from=builder /gossaSrc/gossa /gossa -ENTRYPOINT [ "/gossa", "-h", "0.0.0.0", "/shared" ] +RUN echo -e 'exec su-exec ${UID}:${GID} /gossa -h ${HOST} -p ${PORT} -k=${SKIP_HIDDEN_FILES} --symlinks=${FOLLOW_SYMLINKS} --prefix=${PREFIX} ${DATADIR}'>> /start.sh +ENTRYPOINT [ "sh", "/start.sh" ] diff --git a/support/readme.md b/support/readme.md index 1fcee4e..d77bbb3 100644 --- a/support/readme.md +++ b/support/readme.md @@ -15,6 +15,7 @@ if you prefer building the image yourself : % sudo docker run -v ~/LocalDirToShare:/shared -p 8001:8001 gossa ``` +the options are settable through environment variables that can be passed starting off the docker image. a fancy docker image using [Caddy](https://caddyserver.com/) is also provided. a simple config is embedded in the docker file, and shows how to use http basic authentication, and automatic TLS for hands-free https 🎉