gin. allow code reload in dev mode

This commit is contained in:
boyska 2018-12-18 00:03:59 +01:00
parent 6fdff2109e
commit 3471ce25e1
3 changed files with 15 additions and 8 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
/vendor
/panelcli
/userpanel
gin-bin

View file

@ -3,11 +3,13 @@ RUN apk --no-cache add git gcc musl-dev
WORKDIR /go/src/git.lattuga.net/boyska/feedpanel/
COPY ./ /go/src/git.lattuga.net/boyska/feedpanel/
ENV GO111MODULE=on
RUN go get ./... && CGO_ENABLED=0 GOOS=linux go install ./...
RUN go get github.com/codegangsta/gin && go get ./... && CGO_ENABLED=0 GOOS=linux go install ./...
CMD /go/bin/gin --all -p 8000 -d ./cmd/userpanel run
FROM busybox
WORKDIR /usr/bin/
COPY --from=builder /go/bin/panelcli /usr/bin/
COPY --from=builder /go/bin/userpanel /usr/bin/
COPY panelui/res/ /go/src/git.lattuga.net/boyska/feedpanel/panelui/res/
ENTRYPOINT ["./userpanel"]
#FROM busybox
#WORKDIR /usr/bin/
#COPY --from=builder /go/bin/panelcli /usr/bin/
#COPY --from=builder /go/bin/userpanel /usr/bin/
#COPY --from=builder /go/bin/gin /usr/bin/
#COPY panelui/res/ /go/src/git.lattuga.net/boyska/feedpanel/panelui/res/
#ENTRYPOINT ["/go/bin/gin", "./cmd/userpanel"]

View file

@ -12,9 +12,13 @@ import (
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "8000"
}
fs := flag.NewFlagSetWithEnvPrefix(os.Args[0], "PANEL", 0)
allowedName := fs.String("allowed-name", "", "Name allowed to forward auth")
addr := fs.String("listen-addr", ":8000", "Address to listen on")
addr := fs.String("listen-addr", ":"+port, "Address to listen on")
fs.Parse(os.Args[1:])
var allowedNames []string