{"id":17415299,"url":"https://github.com/adnanrahic/serverless-docker-image-resize","last_synced_at":"2025-09-14T04:30:44.668Z","repository":{"id":26137872,"uuid":"107423907","full_name":"adnanrahic/serverless-docker-image-resize","owner":"adnanrahic","description":"Simple serverless image resize on-the-fly - Deploy with one command - Built with AWS Lambda and S3","archived":false,"fork":false,"pushed_at":"2023-04-19T07:55:44.000Z","size":94,"stargazers_count":125,"open_issues_count":6,"forks_count":28,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-12-28T19:50:11.085Z","etag":null,"topics":["aws","aws-lambda","aws-lambda-node","aws-s3","docker","docker-compose","image-processing","serverless","serverless-framework"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adnanrahic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-18T15:01:22.000Z","updated_at":"2023-11-26T09:31:52.000Z","dependencies_parsed_at":"2024-10-18T22:46:59.667Z","dependency_job_id":"07a8c955-9f7a-4e27-86c1-852a8b0bc59f","html_url":"https://github.com/adnanrahic/serverless-docker-image-resize","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adnanrahic%2Fserverless-docker-image-resize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adnanrahic%2Fserverless-docker-image-resize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adnanrahic%2Fserverless-docker-image-resize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adnanrahic%2Fserverless-docker-image-resize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adnanrahic","download_url":"https://codeload.github.com/adnanrahic/serverless-docker-image-resize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232949859,"owners_count":18601386,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-lambda","aws-lambda-node","aws-s3","docker","docker-compose","image-processing","serverless","serverless-framework"],"created_at":"2024-10-17T01:26:24.051Z","updated_at":"2025-01-07T23:12:46.958Z","avatar_url":"https://github.com/adnanrahic.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Image resize on the fly AWS Lambda function with Serverless and Node.js\n\nA simple Serverless service for creating an image resize-on-the-fly function with AWS Lambda. For Sharp to work correctly it must be installed in the same environment the production is running in. Because AWS Lambda is running on Amazon Linux it must be installed on the same system.\n\nFor this purpose we're using Docker to spin up a container, install the Serverless Framework and deploy the function from inside the container.\n\nThis service will deploy both the AWS Lambda function and AWS S3 bucket from where the images will be grabbed, resized and put back.\n\n## Getting Started (Ubuntu-based Linux Systems)\n\nThese instructions will get you up and running. See deployment for notes on how to deploy the project on a live system.\n\n#### Clone to your local machine:\n\n```bash\n$ git clone https://github.com/adnanrahic/serverless-docker-image-resize.git\n```\n\n#### Change into the cloned dir:\n```bash\n$ cd serverless-docker-image-resize\n```\n\n#### Install Docker and docker compose:\n\n1. Install Docker\n```bash\n$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -\n$ sudo add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable\"\n$ sudo apt-get update\n$ apt-cache policy docker-ce\n$ sudo apt-get install -y docker-ce\n```\nAfter typing the command:\n```bash\n$ sudo systemctl status docker\n```\nYou should see the service is running.\n```bash\nOutput\n● docker.service - Docker Application Container Engine\n   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)\n   Active: active (running) since Sun 2016-05-01 06:53:52 CDT; 1 weeks 3 days ago\n     Docs: https://docs.docker.com\n Main PID: 749 (docker)\n```\n\n2. Install Docker Compose\n```bash\n$ sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose\n$ sudo chmod +x /usr/local/bin/docker-compose\n$ docker-compose -v\n```\nThis will print the installed version:\n```bash\nOutput\ndocker-compose version 1.21.2, build a133471\n```\n\nAll dependencies are installed. Now, deployment is a breeze.\n\n## Deployment\n\n### Configure secrets\n\n#### 1. `secrets.json`\n\nThe `deploy.sh` script will autogenerate this file. No need to touch it at all.\n\n#### 2. `secrets.env`\n\nAdd your secret keys and configuration variables here.\n```env\nSLS_KEY=XXX\nSLS_SECRET=YYY\nSTAGE=dev\nREGION=us-east-1\nBUCKET=images.your-domain.com\n```\n\n### Run Docker Compose\n```bash\n$ docker-compose up --build\n```\nThis will build the image, create a container, run the `deploy.sh` script inside the container and deploy all the resources.\n\nThe command line will log out the service endpoints and all info. What's important to note is the bucket name and URL you need to access your images. Check out [Usage](#usage).\n\n## Usage\n\nAfter the service has been deployed, you will receive a bucket endpoint. You will add a query parameter to it in order to tell it how to resize the image. The bucket will behave as a public website.\n\nLet's upload an image so we have something to work with.\n```bash\n$ aws s3 cp --acl public-read IMAGE_NAME.jpg s3://BUCKET\n```\n\nExample 1:\n```\nhttp://BUCKET.s3-website.REGION.amazonaws.com/420x360/IMAGE_NAME.jpg\n```\n\nOr you can access the lambda function directly.\n\nExample 2:\n```\nhttps://LAMBDA_ID.execute-api.REGION.amazonaws.com/dev/resize?key=420x360/IMAGE_NAME.jpg\n```\n\nThis will resize the image in the fly and send you back the resized image while storing it for further reference.\n\n## Credits\nThe original tutorial for resizing S3 images I followed can be found [here](https://aws.amazon.com/blogs/compute/resize-images-on-the-fly-with-amazon-s3-aws-lambda-and-amazon-api-gateway/)!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadnanrahic%2Fserverless-docker-image-resize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadnanrahic%2Fserverless-docker-image-resize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadnanrahic%2Fserverless-docker-image-resize/lists"}