Coder Social home page Coder Social logo

sayi21cn / nginx-image-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wantedly/nginx-image-server

0.0 2.0 0.0 681 KB

Dockerfile for Dynamic Image Transformation Server with Nginx and Small Light module

License: MIT License

Ruby 45.01% HTML 8.32% Nginx 16.88% Perl 5.83% Shell 21.38% Python 2.58%

nginx-image-server's Introduction

Nginx Image Server Docker Repository on Quay.io

Docker Image for Nginx server for image processing with ngx_small_light. It supports resizing/cropping/formatting (png, webp...etc) of images stored in local storages or AWS S3.

Please see https://github.com/cubicdaiya/ngx_small_light for more information about image processing.

SUPPORTED TAGS

  • latest
  • Nginx 1.6.2
  • ngx_small_light 0.6.8
  • ImageMagick 6.8.6-8 (Q16) with WebP support

HOW TO USE

# Get the docker image
$ docker pull quay.io/wantedly/nginx-image-server

# Fetch an example image to try image-processing local image
$ curl -L https://raw.githubusercontent.com/wantedly/nginx-image-server/master/examples/example.jpg > \
    /tmp/example.jpg

# Start the image server
$ docker run \
    --rm \
    -it \
    --name nginx-image-server \
    -p 80:80 \
    -p 8090:8090 \
    -v /tmp/example.jpg:/var/www/nginx/images/example.jpg \
    -e "SERVER_NAME=image.example.com" \
    -e "S3_HOST=<YOUR-BUCKET-NAME>.s3.amazonaws.com" \
    quay.io/wantedly/nginx-image-server:latest

Then you can try image-processing by accessing

  • Images in S3: http://<YOUR-SERVER.com>/small_light(dh=400,da=l,ds=s)/<PATH-TO-IMAGE-IN-S3>
  • Images in Local: http://<YOUR-SERVER.com>/local/small_light(dh=400,da=l,ds=s)/images/example.jpg

And http://<YOUR-SERVER.com>:8090/status retruns the nginx status.

Custom configuration

You can build a docker image includes your own nginx.conf:

FROM quay.io/wantedly/nginx-image-server
COPY nginx.conf /etc/nginx/nginx.conf

Then build with docker build -t your-nginx-image-server . and run:

$ docker run \
    -d \
    --name your-nginx-image-server \
    -p 80:80 \
    your-nginx-image-server

Be sure to include daemon off; in your custom configuration to run Nginx in the foreground. Otherwise your container will stop immediately after starting.

HOW TO DEVELOP

# on your local machine
$ git clone https://github.com/wantedly/nginx-image-server.git && cd nginx-image-server
$ script/bootstrap
$ cp .env.sample .env
# .env
TIMEZONE=Asia/Tokyo
$ vagrant up
$ vi Dockerfile

# login to VM and test it
$ vagrant ssh
@core-01 $ cd share
@core-01 $ docker build -t=quay.io/wantedly/nginx-image-server .
@core-01 $ script/test

TEST

wercker status

Feature(behavior) test

Behavior test with infrataster. Test files are under test/feature directory. You can run this test with follwing script:

$ script/test

Performance test

Performance test with locust. Test files are under test/performance directory. You can run locust with follwing script:

# Run target container
$ script/run-target

# Export target IP
$ export TARGET_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' nginx-image-server)

# Run locust as WebTool
$ script/run-locust -f locustfile.py -H http://${TARGET_IP}

# Run locust as CLI
$ script/run-locust -f locustfile.py -H http://${TARGET_IP} --no-web -c 5 -r 1 -n 10

LICENSE

MIT License

nginx-image-server's People

Contributors

awakia avatar cubicdaiya avatar dtan4 avatar luvtechno avatar spesnova avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.