Skip to content

Latest commit

 

History

History
147 lines (118 loc) · 3.58 KB

README.md

File metadata and controls

147 lines (118 loc) · 3.58 KB

Image Optimizer Backend

Build Deploy Lint Build


Table of Contents

Installation

Backend (this repo)

  • Without docker

    •   # Clone this repository
        git clone https://github.com/dekiakbar/image-optimizer
    •   # Navigate to project dir
        cd image-optimizer
    •   # Install node modules and dependencies
        npm install
    •   # Run app
      
        # development
        $ npm run start
      
        #  Watch mode
        $ npm run start:dev
      
        # production mode
        $ npm run start:prod
    •   # access swager api
        http://localhost:<port>/api
  • Docker

    •   # Clone this repository
        git clone https://github.com/dekiakbar/image-optimizer
    •   # Navigate to project dir
        cd image-optimizer
    •   # Build image and start container
        docker-compose up -d
    •   # access swagger api
        http://localhost:3000/api
    • NOTE : if you wanna run npm command, please use this.

      docker-compose run --rm node npm install --legacy-peer-deps

Deployment

  • Docker

    •   # Clone this repository
        git clone https://github.com/dekiakbar/image-optimizer
    •   # Navigate to project dir
        cd image-optimizer
    •   # Build image and start container
        docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d

Environment Variable

Copy env.example to .env

cp .env.example .env

Fill the required env variables:

PORT=3000

# Storage type for save image
# valid :
# - S3
STORAGE_TYPE=S3

# if use S3 as storage
S3_BUCKET_NAME=
S3_REGION=global
S3_ENDPOINT=
S3_ACCESS_KEY_ID=
S3_SECRET_ACCESS_KEY=

# separated by space and please provide (dot) before list the extension
ALLOWED_FILE_TYPE=.jpeg .jpg .png
MAX_FILE_UPLOAD=5
# max upload size in KB
MAX_UPLOAD_SIZE=8192

Frontend

You must install image optimizer Frontend.

License

MIT