Packaging your site with BobyMCbobs/go-http-server
A webserver, serving on port 8080, can be brought up instantly to share files.
go install gitlab.com/BobyMCbobs/go-http-server@latest
go-http-server
Just serve your site
FROM registry.gitlab.com/bobymcbobs/go-http-server:latest
COPY site /app/site
Serve your site and set headers
FROM registry.gitlab.com/bobymcbobs/go-http-server:latest
env APP_HEADER_SET_ENABLE=true \
APP_HEADER_MAP_PATH=./headers.yaml
COPY site /app/site
COPY headers.yaml /app/headers.yaml
Serve your site using history mode
FROM registry.gitlab.com/bobymcbobs/go-http-server:latest
env APP_VUEJS_HISTORY_MODE=true
COPY dist /app/dist
Serve your site using history mode and Go html templating for index.html
FROM registry.gitlab.com/bobymcbobs/go-http-server:latest
ENV APP_SERVE_FOLDER=./dist \
APP_VUEJS_HISTORY_MODE=true \
APP_TEMPLATE_MAP_PATH=/app/template-map.yaml
COPY dist /app/dist
COPY template-map.yaml /app/template-map.yaml
Serve your site using history mode and Go html templating for index.html, with setting headers
FROM registry.gitlab.com/bobymcbobs/go-http-server:latest
ENV APP_SERVE_FOLDER=./dist \
APP_VUEJS_HISTORY_MODE=true \
APP_TEMPLATE_MAP_PATH=/app/template-map.yaml \
APP_HEADER_SET_ENABLE=true \
APP_HEADER_MAP_PATH=./headers.yaml
COPY dist /app/dist
COPY headers.yaml /app/headers.yaml
COPY template-map.yaml /app/template-map.yaml
Sometimes it is useful to implement go-http-server with importing it
package main
import (
common "gitlab.com/BobyMCbobs/go-http-server/pkg/common"
ghs "gitlab.com/BobyMCbobs/go-http-server/pkg/httpserver"
)
func main() {
ghs.NewWebServer().
SetServeFolder(common.GetEnvOrDefault("KO_DATA_PATH", "./")).
Listen()
}