A service for uploading and storing images
175
A service for uploading and storing images
git clone https://github.com/madflow/imgdmp
cd imgdmp
yarn
# npm install
yarn start
# npm start
In order to upload in image the environment variable BEARER_TOKEN= has to be set. It is your responsibility to provide this variable.
.env variables to accomplish this. There is a env.dist in the root of this repository that can simply be copied to .env.-e "BEARER_TOKEN=XXXXX". Since this would print the secret this method is discouraged.Example docker-compose.yml
version: "3"
services:
imgdmp:
image: madflow/imgdmp
ports:
- 80:3000
environment:
- NODE_ENV=production
- BEARER_TOKEN=${BEARER_TOKEN}
volumes:
- imgdmp-data:/app/data
volumes:
imgdmp-data:
driver: local
Example Docker run
docker run -v "imgdmp-data:/app/data" -e "NODE_ENV=production" -m "300M" --memory-swap "1G" -p "3000:3000" madflow/imgdmp
curl
curl -i -X POST -H "Authorization: Bearer mybearer" -F "[email protected]" http://127.0.0.1:3000/upload/
HTTPie
http -f http://localhost:3000/upload Authorization:"Bearer mybearer" [email protected]
{
"expires": "2018-11-11T00:00:00.000Z",
"fileName": "dbbee845752a21601777fac446332e63.png",
"id": "MlWQjOtxwy5MEfEB",
"mimetype": "image/png",
"originalName": "myimage.png",
"self": "/images/dbbee845752a21601777fac446332e63.png"
}
| Field | Description | Example |
|---|---|---|
| image | The local image | |
| expires | The expiration date of the image | 2018-11-11 |
Content type
Image
Digest
Size
99.5 MB
Last updated
about 6 years ago
docker pull madflow/imgdmp