cahva / baseimages-nginxawsauth

Docker baseimage for nginx with awsauth module baked in

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Baseimage for nginx with s3

Running this image will let you turn nginx as a proxy for s3 bucket. Usually you will use this to setup your nginx server with cache so you won't have to fetch files from s3 all the time.

Whats included

How to use

Checkout the example folder. It contains nginx conf template and start script. start.sh script replaces s3 tags from your nginx template and runs nginx in no-daemon mode. Your S3 credentials should be set in the env when running that image.

in the example folder

Build it

docker build -t my-nginx-s3 .

Run it

docker run -it --rm \
-e AWS_BUCKET=[aws-bucket] \
-e AWS_ACCESS_KEY=[aws-accesskey] \
-e AWS_SECRET_ACCESS_KEY=[aws-secretkey] \
-v `pwd`/nginx.conf.tmpl:/tmp/nginx.conf.tmpl \
-p 8000:80 --name running-nginx my-nginx-s3

Test it

Put something in your bucket either in AWS console or upload it using curl or Postman or whatever.. Point your browser to http://localhost:8000/yourfile.jpg. (localhost won't probably work if you started this on the commandline, inspect the running container to find it's ip)

Versioning

[tag] will be versioned with v1, v2 and so on.. "latest" is the master branch.

About

Docker baseimage for nginx with awsauth module baked in


Languages

Language:Shell 100.0%