Simple HTTP file server. POST and GET uploaded files with storage. Useful for low scale file needs.
10K+
Simple HTTP based file server.
Supports Uploading and Downloads.
For upload, if using POST Method, it will create a new file with a UUID name. If using PUT method, it will create the file with the same name as in request URI.
This server obeys ETag semantics. Check info at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag
version: '3.7'
services:
simple-file-server:
build: .
image: flaviostutz/simple-file-server
ports:
- "4000:4000"
environment:
- WRITE_SHARED_KEY=
- READ_SHARED_KEY=
- LOCATION_BASE_URL=http://localhost:4000
- LOG_LEVEL=debug
Run docker-compose up
Execute
curl -d '{"key1":"value1", "key2":"value2"}' -H "Content-Type: application/json" -X PUT http://localhost:4000/dir1/file1.json
curl http://localhost:4000/dir1/file1.json
curl -d '{"key1":"value1", "key2":"value2"}' -H "Content-Type: application/json" -X POST http://localhost:4000/dir2
POST /dir1/dir2 - creates a new file inside /dir1/dir2
GET /dir1/dir2/c106fc67-eadb-4d91-beb1-66fc5c35e6a6 - get file contents along with ETag Header, Mime-Type and Cache-Control as set during creation/update
PUT /dir1/dir2/c106fc67-eadb-4d91-beb1-66fc5c35e6a6 - updates and existing file or creates a new one with with a custom name (names are arbitrary and don't need to be an uuid)
To run automated tests againts REST API, run
docker-compose -f docker-compose.test.yml up --build
This will build and run "simple-file-server" and another container with POSTMAN scripts to be executed against the server and check results.
For more info on how this "POSTMAN" runner works, go to https://github.com/flaviostutz/postman-runner
This tests will be run automatically if this repo is integrated to DockerHub with "Automated Tests" enabled (https://docs.docker.com/docker-hub/builds/automated-testing/).
Content type
Image
Digest
Size
194 MB
Last updated
about 6 years ago
docker pull flaviostutz/simple-file-server