Skip to content

A compact tool for serving static files from AWS S3 object storage with in-memory caching

License

Notifications You must be signed in to change notification settings

yegor-usoltsev/go-serve-s3

Repository files navigation

go-serve-s3

Build Status Codecov GitHub Release Docker Image (docker.io) Docker Image (ghcr.io) Docker Image Size

A compact tool for serving static files from AWS S3 object storage with in-memory caching.

Usage

AWS S3

Minimal example using AWS S3 (using credentials from host's ~/.aws directory):

docker run -d \
  -e APP_S3_BUCKET=my-bucket \
  -v ~/.aws:/root/.aws:ro \
  -p 8080:8080 \
  yusoltsev/go-serve-s3:latest

MinIO

Minimal example using MinIO (local S3-compatible storage):

docker run -d \
  -e APP_S3_BUCKET=my-bucket \
  -e APP_S3_REGION=us-east-1 \
  -e APP_S3_ENDPOINT_URL=http://minio:9000 \
  -e APP_S3_USE_PATH_STYLE=true \
  -e AWS_ACCESS_KEY_ID=minioadmin \
  -e AWS_SECRET_ACCESS_KEY=minioadmin \
  -p 8080:8080 \
  yusoltsev/go-serve-s3:latest

Environment Variables

KEY TYPE DEFAULT REQUIRED
APP_SERVER_HOST string 0.0.0.0 Yes
APP_SERVER_PORT uint16 8080 Yes
APP_S3_BUCKET string Yes
APP_S3_REGION string No
APP_S3_ENDPOINT_URL string No
APP_S3_USE_PATH_STYLE bool No
APP_CACHING_CAPACITY_ITEMS int 1024 Yes
APP_CACHING_CAPACITY_BYTES int 52428800 (50 MiB) Yes
APP_CACHING_TTL Duration 10m (10 minutes) Yes

You should also provide valid AWS credentials using AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, or through other supported environment variables. For details, refer to the AWS SDK documentation.

Docker Images

This application is delivered as a multi-platform Docker image and is available for download from two image registries of choice: yusoltsev/go-serve-s3 and ghcr.io/yegor-usoltsev/go-serve-s3.

Versioning

This project uses Semantic Versioning

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

License

MIT

About

A compact tool for serving static files from AWS S3 object storage with in-memory caching

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •