A compact tool for serving static files from AWS S3 object storage with in-memory caching.
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
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
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.
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.
This project uses Semantic Versioning
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.