Thumbor
Running with Docker
Unfortunately Thumbor doesn't have an official Docker image it looks like, but there are some trusted unofficial images, in particular, the minimalcompact/thumbor
image.
version: '3'
services:
thumbor:
ports:
- 8450:80
image: ghcr.io/minimalcompact/thumbor
environment:
# VIRTUAL_HOST is picked up by nginx-proxy. Here it's set for localhost
# but you usually need to point it to your domain, e.g. thumbor.example.com
- VIRTUAL_HOST=localhost
# THUMBOR_NUM_PROCESSES control how many processes run inside the container
# Normally this is set in connection with the number of CPU cores
# Note however that you can also use the docker-compose scale option to dynamically
# scale your thumbor instances
- THUMBOR_NUM_PROCESSES=4
# this would allow CORS from any origin (you can restrict to specific origins if you want)
- CORS_ALLOW_ORIGIN=*
# returns a webp image if browser Accept headers match
- AUTO_WEBP=True
# nginx-proxy does caching automatically, so no need to store the result storage cache
# (this greatly speeds up and saves on CPU)
- RESULT_STORAGE=thumbor.result_storages.no_storage
- RESULT_STORAGE_STORES_UNSAFE=True
- STORAGE=thumbor.storages.file_storage
restart: always
networks:
{}- app
nginx-proxy:
image: ghcr.io/minimalcompact/thumbor-nginx-proxy-cache
environment:
# setting the DEFAULT_HOST to the same as the VIRTUAL_HOST above.
# Makes sure it works irrespective of the host name
# Normally this won't be necessary, but it helps for testing.
- DEFAULT_HOST=localhost
# optional: control cache memory size (default 500m), cache size (default 10g) and inactive (default 300m)
# see https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_path
- PROXY_CACHE_SIZE=10g
- PROXY_CACHE_MEMORY_SIZE=500m
- PROXY_CACHE_INACTIVE=300m
volumes:
# this is essential for nginx-proxy to detect docker containers, scaling etc
# see https://github.com/nginx-proxy/nginx-proxy
- /var/run/docker.sock:/tmp/docker.sock:ro
# mapping cache folder, to persist it independently of the container
- ./cache:/var/cache/nginx
ports:
- "80:80"
- "443:443"
restart: always
networks:
- app
volumes:
cache:
driver: local
networks:
app:
driver: bridge