Custom build of Code Sky Blue Go Http Server, a simple file server in Go.
4.6K
The image proposed by the original dev was 4 years old, when his github repo is still actively maintained. So this is a recent build, with the code fresh from github, with a few security fixes (see [https://github.com/codeskyblue/gohttpserver/pull/233/commits](PR 233) Also, google analytics has been disabled.
Cheers
To build your own, clone the original repo, and replace the Docker file with the following:
FROM golang:alpine AS build
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
# Binary Compression
RUN apk upgrade --no-cache && apk add upx --no-cache
# Build app and pack using upx
ADD . /app
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags '-s -w -X main.VERSION=docker' -o gohttpserver && upx gohttpserver
FROM alpine:3
WORKDIR /app
ADD assets /usr/local/bin/assets
COPY --from=build /app/gohttpserver /usr/local/bin/gohttpserver
EXPOSE 8000
ENTRYPOINT [ "/usr/local/bin/gohttpserver" , "--root=/app/public", "--google-tracker-id=\"\""]
And build with your desired architecture if not provided.
Sample docker-compose without any configuration
name: myServer_web
services:
web:
image: abesnier/gohttpserver
container_name: myServer_web
volumes:
- "./sharedDirectory:/app/public"
environment:
- TZ=Europe/Paris
restart: always
ports:
- "80:8000" # internat exposed port is 8000, map to your desired port
Sample docker-compose to use with Nginx Proxy Manager (using a shared nginxproxymanager network, no need to expose any port), with a .ghs.yml configuration file
name: myServer_web
services:
web:
image: abesnier/gohttpserver
container_name: myServer_web
volumes:
- "./sharedDirectory:/app/public"
environment:
- TZ=Europe/Paris
command: --conf /app/public/.ghs.yml
restart: always
networks:
- npm_default
networks:
npm_default:
name: nginxproxymanager_default
external: true
.ghs.yml sample
title: "My Page Title"
theme: black #two themes only, green or black
accessTables:
- regex: msg #hides files that contain 'msg' in their name
allow: false
- regex: .ghs.yml #hides the configuration file itself
allow: false
Content type
Image
Digest
sha256:2464b25be…
Size
10.3 MB
Last updated
8 days ago
docker pull abesnier/gohttpserver