Serves files to the public, static content host, etc.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Steven Polley 373077e01d go mod init 2 years ago
.drone.yml remove production pipeline step 3 years ago
Dockerfile add maintainer to Dockerfile 2 years ago Update readme and docker-compose example 2 years ago
docker-compose.yml Update readme and docker-compose example 2 years ago
go.mod go mod init 2 years ago
main.go Remove fmt package 3 years ago

Build Status

Serves files to the public, static content to any files in ./public

This is meant to be a spot for non-changing content, to host files to allow me to share with others. In most cases it'll be best practice to keep project-related files within the project directory and serve public static content from a webserver within that project.


  1. First, install Go.
  2. Then, install Docker - see left menu for other distibutions.
  3. Finally, install [docker-compose](sudo curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose)

Build Application

go build -a -ldflags '-w'

You may need to log out and back in afterwards to ensure the "go" command is set in your PATH environment variable, otherwise it may say it's an invalid command.

Build Container

Disclaimer! If you use this, you’ll need to build the container yourself. I have a CICD pipeline setup, but my registry is used for my internal infrastructure only and is not publicly available.

Because this is a staticly linked binary with no external runtime dependancies, the container literally only contains the binary file, keeping it clean and low in size (6.3MB). I never did understand why people include operating systems in containers.

docker build -t publicfileserver:latest .

Example docker-compose.yml

version: '3.7'

    image: publicfileserver:latest
    restart: always
      - 8080:8080
      - /data/public:/public

In this example, data stored on your host disk /data/public would be served


git clone
docker build -t publicfileserver:latest .
docker-compose up -d