diff --git a/.goreleaser.yml b/.goreleaser.yml index cb9ff9d..8451b5a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -17,10 +17,12 @@ builds: - "6" main: . ldflags: -s -w -X main.VERSION={{.Version}} - flags: -tags bindata + flags: -tags vfs binary: gohttpserver + hooks: + pre: go generate . archive: - format: tar.gz + format: zip name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' files: diff --git a/Dockerfile b/Dockerfile index 12fefff..e3d579f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,4 +12,5 @@ VOLUME /app/public ADD assets ./assets COPY --from=0 /go/src/github.com/codeskyblue/gohttpserver/gohttpserver . EXPOSE 8000 -CMD ["/app/gohttpserver", "--root=/app/public"] +ENTRYPOINT [ "/app/gohttpserver" ] +CMD ["--root=/app/public"] diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json deleted file mode 100644 index d0e6ac0..0000000 --- a/Godeps/Godeps.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "ImportPath": "github.com/codeskyblue/gohttpserver", - "GoVersion": "go1.9", - "GodepVersion": "v79", - "Deps": [ - { - "ImportPath": "github.com/DHowett/go-plist", - "Rev": "233df3c4f07b0c562da0e8a6fb850681ac49bb90" - }, - { - "ImportPath": "github.com/alecthomas/kingpin", - "Comment": "v2.2.0", - "Rev": "92b2733684bc5f1971162349ce098fe0d070e2a9" - }, - { - "ImportPath": "github.com/alecthomas/template", - "Rev": "a0175ee3bccc567396460bf5acd36800cb10c49c" - }, - { - "ImportPath": "github.com/alecthomas/template/parse", - "Rev": "a0175ee3bccc567396460bf5acd36800cb10c49c" - }, - { - "ImportPath": "github.com/alecthomas/units", - "Rev": "2efee857e7cfd4f3d0138cc3cbb1b4966962b93a" - }, - { - "ImportPath": "github.com/codeskyblue/dockerignore", - "Rev": "de82dee623d9207f906d327172149cba50427a88" - }, - { - "ImportPath": "github.com/codeskyblue/go-accesslog", - "Rev": "6188d3bd9371c3caba018648c6acd9cdf805787e" - }, - { - "ImportPath": "github.com/codeskyblue/openid-go", - "Rev": "0d30842b2fb4704849cd07f6fba862a7a9f4b403" - }, - { - "ImportPath": "github.com/go-yaml/yaml", - "Rev": "e4d366fc3c7938e2958e662b4258c7a89e1f0e3e" - }, - { - "ImportPath": "github.com/goji/httpauth", - "Rev": "2da839ab0f4df05a6db5eb277995589dadbd4fb9" - }, - { - "ImportPath": "github.com/gorilla/context", - "Comment": "v1.1-7-g08b5f42", - "Rev": "08b5f424b9271eedf6f9f0ce86cb9396ed337a42" - }, - { - "ImportPath": "github.com/gorilla/handlers", - "Comment": "v1.2", - "Rev": "3a5767ca75ece5f7f1440b1d16975247f8d8b221" - }, - { - "ImportPath": "github.com/gorilla/mux", - "Comment": "v1.1-27-g757bef9", - "Rev": "757bef944d0f21880861c2dd9c871ca543023cba" - }, - { - "ImportPath": "github.com/gorilla/securecookie", - "Comment": "v1.1-5-gfa5329f", - "Rev": "fa5329f913702981df43dcb2a380bac429c810b5" - }, - { - "ImportPath": "github.com/gorilla/sessions", - "Comment": "v1.1", - "Rev": "ca9ada44574153444b00d3fd9c8559e4cc95f896" - }, - { - "ImportPath": "github.com/pkg/errors", - "Comment": "v0.8.0-1-g839d9e9", - "Rev": "839d9e913e063e28dfd0e6c7b7512793e0a48be9" - }, - { - "ImportPath": "github.com/shogo82148/androidbinary", - "Rev": "2fb750de4ec6a45853fcc5f85694eab47e1007f9" - }, - { - "ImportPath": "github.com/shogo82148/androidbinary/apk", - "Rev": "2fb750de4ec6a45853fcc5f85694eab47e1007f9" - }, - { - "ImportPath": "golang.org/x/net/html", - "Rev": "a625e3953219464fdd5611bb48bf87c927717295" - }, - { - "ImportPath": "golang.org/x/net/html/atom", - "Rev": "a625e3953219464fdd5611bb48bf87c927717295" - } - ] -} diff --git a/Godeps/Readme b/Godeps/Readme deleted file mode 100644 index 4cdaa53..0000000 --- a/Godeps/Readme +++ /dev/null @@ -1,5 +0,0 @@ -This directory tree is generated automatically by godep. - -Please do not edit. - -See https://github.com/tools/godep for more information. diff --git a/README.md b/README.md index a99fe46..8310623 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ **Binaries** can be downloaded from [this repo releases](https://github.com/codeskyblue/gohttpserver/releases/) -## Notes -If using go1.5, ensure you set GO15VENDOREXPERIMENT=1 +## Requirements +Tested with go-1.10, go-1.11 ## Screenshots ![screen](testdata/filetypes/gohttpserver.gif) @@ -61,21 +61,38 @@ cd $GOPATH/src/github.com/codeskyblue/gohttpserver go build && ./gohttpserver ``` -## Docker Usage -share current directory -```bash -docker run -it --rm -p 8000:8000 -v $PWD:/app/public --name gohttpserver codeskyblue/gohttpserver -``` -share current directory with http oauth -```bash -docker run -it --rm -p 8000:8000 -v $PWD:/app/public --name gohttpserver codeskyblue/gohttpserver ./gohttpserver --root /app/public --auth-type http --auth-http username:password -``` +Or download binaries from [github releases](https://github.com/codeskyblue/gohttpserver/releases) ## Usage Listen on port 8000 of all interfaces, and enable file uploading. ``` -./gohttpserver -r ./ --addr :8000 --upload +./gohttpserver -r ./ --port 8000 --upload +``` + +Use command `gohttpserver --help` to see more usage. + +## Docker Usage +share current directory + +```bash +docker run -it --rm -p 8000:8000 -v $PWD:/app/public --name gohttpserver codeskyblue/gohttpserver +``` + +Share current directory with http basic auth + +```bash +docker run -it --rm -p 8000:8000 -v $PWD:/app/public --name gohttpserver \ + codeskyblue/gohttpserver --root /app/public \ + --auth-type http --auth-http username:password +``` + +Share current directory with openid auth. (Works only in netease company.) + +```bash +docker run -it --rm -p 8000:8000 -v $PWD:/app/public --name gohttpserver \ + codeskyblue/gohttpserver --root /app/public \ + --auth-type openid ``` ## Authentication options @@ -91,8 +108,6 @@ Listen on port 8000 of all interfaces, and enable file uploading. $ gohttpserver --auth-type openid --auth-openid https://login.example-hostname.com/openid/ ``` - The openid returns url using "http" instead of "https", but I am not planing to fix this currently. - - Enable upload ```sh @@ -156,11 +171,11 @@ This is used for server on which https is enabled. default use + ## FAQ - [How to generate self signed certificate with openssl](http://stackoverflow.com/questions/10175812/how-to-create-a-self-signed-certificate-with-openssl) @@ -185,20 +223,23 @@ The search query follows common format rules just like Google. Keywords are sepe 1. `hello -world` means must contains `hello` but not contains `world` ## Developer Guide -Depdencies are managed by godep +Depdencies are managed by [govendor](https://github.com/kardianos/govendor) -```sh -go generate . -go build -tags vfs -``` +1. Build develop version. **assets** directory must exists -Theme are all defined in [res/themes](res/themes) directory. Now only two themes are available, "black" and "green". + ```sh + go build + ./gohttpserver + ``` +2. Build single binary release + + ```sh + go generate . + go build -tags vfs + ``` + +Theme are defined in [assets/themes](assets/themes) directory. Now only two themes are available, "black" and "green". -## How to build single binary release -```sh -go-bindata-assetfs -tags bindata res/... -go build -tags bindata -``` ## Reference Web sites diff --git a/assets/index.html b/assets/index.html index 251b52b..c3aa6ca 100644 --- a/assets/index.html +++ b/assets/index.html @@ -37,16 +37,17 @@ [[if eq .AuthType "openid"]] -