Recently, I found myself needing a static file server for sharing files on my home network through HTTP. I wanted to do this so I could easily share files with people in my house by sending them a link they can use to download files. Simple and straightforward!!
Even though I have SMB and FTP on my homelab, not all my family members and friends are tech savvy enough to connect to them on their phones and computers.
I also wanted something that was quick and straightforward to setup; so I decided to use serve, a static file server from Vercel.
Serve is a Nodejs project, but I wanted to run it on my raspberry pi home-lab running Docker. To achieve this, I created a docker image for it. You can find it on Docker Hub as eldekyfin/serve.
How to setup serve
Docker & Compose
If you use docker, you can get it running by using this docker-compose.yml file.
version: "3.8"
services:
serve:
image: elDekyfin/serve
restart: unless-stopped
ports:
- 8080:8080
volumes:
- /path/to/shared/folder:/var/static
This approach allows you to have the server on without needing to manually start it all the time. Learn more about Docker
Without Docker
If you want to use server without docker, you need to use the npm package by following the instructions below:
- Download and install nodejs for your operating system using this link
- Install serve by running the command
npm install -g serve - Run it with the command
serve /path/to/shared/folderwherepath/to/shared/folderis the path to the folder you want to share.
