Docker micro-service to resize image on the fly.
This project use ginsen/image-resizer fork from tripviss/image-resizer as engine to resize/optimize
images on-the-fly.
Download docker image from DockerHub (Recommended)
Run the Docker image, publish port 3001 and provide configuration via environment variables:
$ docker run -d --name server-resizer \
-p 3001:3001 \
-e AWS_ACCESS_KEY_ID={your-access-key} \
-e AWS_SECRET_ACCESS_KEY={your-secret-access} \
-e AWS_REGION={your-region} \
-e S3_BUCKET={your-bucket} \
ginsen/image-resizer
Remember replace your-access-key, your-secret-access, your-region and your-bucket with your valid params to connect with your S3 store.
You can also run as a daemon (replace --rm -ti
with -d
), then use docker logs -f server-resizer
to watch the log
output on-demand.
Request an image-resizer url from your browser, e.g., http://localhost:3001/h200-cfit/commons/c/c4/Monkey_Island.jpg.
See the documentation for image-resizer for additional environment variables and API usage.
Build docker image from GitHub
Download this project with git and build image docker.
$ git clone https://github.com/ginsen/docker-image-resizer.git
$ cd docker-image-resizer
$ docker build -t my-custom-resizer .
NOTE: Don't forget the last dot.
When the image docker is has build, create the docker container with your S3 environment vars and run server in 3001 tcp/port.
$ docker run -d --name server-resizer \
-p 3001:3001 \
-e AWS_ACCESS_KEY_ID={your-access-key} \
-e AWS_SECRET_ACCESS_KEY={your-secret-access} \
-e AWS_REGION={your-region} \
-e S3_BUCKET={your-bucket} \
my-custom-resizer