Skip to content

Commit 0e58d08

Browse files
feat: Add imgproxy template
1 parent 38e417b commit 0e58d08

File tree

4 files changed

+154
-0
lines changed

4 files changed

+154
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
version: "3.8"
2+
services:
3+
imgproxy:
4+
image: darthsim/imgproxy:v3.30.1
5+
restart: unless-stopped
6+
expose:
7+
- 8080
8+
environment:
9+
IMGPROXY_KEY: ${IMGPROXY_KEY}
10+
IMGPROXY_SALT: ${IMGPROXY_SALT}
11+
IMGPROXY_ENABLE_WEBP_DETECTION: ${IMGPROXY_ENABLE_WEBP_DETECTION:-true}
12+
IMGPROXY_ENFORCE_WEBP: ${IMGPROXY_ENFORCE_WEBP:-true}
13+
IMGPROXY_TTL: ${IMGPROXY_TTL:-30600}
14+
IMGPROXY_DEVELOPMENT_ERRORS_MODE: ${IMGPROXY_DEVELOPMENT_ERRORS_MODE:-false}
15+
IMGPROXY_READ_TIMEOUT: ${IMGPROXY_READ_TIMEOUT:-10}
16+
IMGPROXY_WRITE_TIMEOUT: ${IMGPROXY_WRITE_TIMEOUT:-10}
17+
IMGPROXY_KEEP_ALIVE_TIMEOUT: ${IMGPROXY_KEEP_ALIVE_TIMEOUT:-10}
18+
IMGPROXY_DOWNLOAD_TIMEOUT: ${IMGPROXY_DOWNLOAD_TIMEOUT:-5}
19+
IMGPROXY_CONCURRENCY: ${IMGPROXY_CONCURRENCY:-}
20+
IMGPROXY_MAX_CLIENTS: ${IMGPROXY_MAX_CLIENTS:-10}
21+
IMGPROXY_SO_REUSEPORT: ${IMGPROXY_SO_REUSEPORT:-}
22+
IMGPROXY_USER_AGENT: ${IMGPROXY_USER_AGENT:-}
23+
IMGPROXY_USE_ETAG: ${IMGPROXY_USE_ETAG:-true}
24+
IMGPROXY_QUALITY: ${IMGPROXY_QUALITY:-80}
25+
IMGPROXY_ALLOWED_SOURCES: ${IMGPROXY_ALLOWED_SOURCES}
26+
IMGPROXY_ALLOW_ORIGIN: ${IMGPROXY_ALLOW_ORIGIN:-*}
27+
IMGPROXY_MAX_SRC_FILE_SIZE: ${IMGPROXY_MAX_SRC_FILE_SIZE:-20971520}
28+
IMGPROXY_MAX_SRC_RESOLUTION: ${IMGPROXY_MAX_SRC_RESOLUTION:-50}
29+
IMGPROXY_LOG_LEVEL: ${IMGPROXY_LOG_LEVEL:-error}
30+
31+
nginx:
32+
image: nginx:1.28.2-alpine
33+
restart: unless-stopped
34+
expose:
35+
- 80
36+
environment:
37+
NGINX_CACHE_LEVELS: ${NGINX_CACHE_LEVELS:-1:2}
38+
NGINX_CACHE_KEYS_ZONE_SIZE: ${NGINX_CACHE_KEYS_ZONE_SIZE:-256m}
39+
NGINX_CACHE_MAX_SIZE: ${NGINX_CACHE_MAX_SIZE:-500m}
40+
NGINX_CACHE_INACTIVE: ${NGINX_CACHE_INACTIVE:-30d}
41+
NGINX_CACHE_USE_TEMP_PATH: ${NGINX_CACHE_USE_TEMP_PATH:-off}
42+
NGINX_CACHE_EXPIRES: ${NGINX_CACHE_EXPIRES:-30d}
43+
depends_on:
44+
- imgproxy
45+
volumes:
46+
- nginx-cache:/tmp/cache
47+
command:
48+
- /bin/sh
49+
- -c
50+
- |
51+
cat <<EOF > /etc/nginx/conf.d/default.conf
52+
proxy_cache_path /tmp/cache levels=$${NGINX_CACHE_LEVELS} keys_zone=my_cache:$${NGINX_CACHE_KEYS_ZONE_SIZE} max_size=$${NGINX_CACHE_MAX_SIZE} inactive=$${NGINX_CACHE_INACTIVE} use_temp_path=$${NGINX_CACHE_USE_TEMP_PATH};
53+
54+
server {
55+
listen 80 default_server;
56+
listen [::]:80 default_server;
57+
58+
location / {
59+
expires $${NGINX_CACHE_EXPIRES};
60+
access_log off;
61+
proxy_ignore_headers Vary;
62+
proxy_cache my_cache;
63+
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
64+
proxy_cache_background_update on;
65+
proxy_cache_lock on;
66+
server_tokens off;
67+
proxy_pass http://imgproxy:8080;
68+
}
69+
}
70+
EOF
71+
exec nginx -g 'daemon off;'
72+
73+
volumes:
74+
nginx-cache:

blueprints/imgproxy/imgroxy.png

4.5 KB
Loading

blueprints/imgproxy/template.toml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
[variables]
2+
main_domain = "${domain}"
3+
imgproxy_key = "${hash:128}"
4+
imgproxy_salt = "${hash:128}"
5+
imgproxy_allowed_sources = "http://${main_domain},https://${main_domain}"
6+
imgproxy_quality = "80"
7+
imgproxy_ttl = "30600"
8+
imgproxy_max_src_file_size = "20971520"
9+
imgproxy_max_src_resolution = "50"
10+
imgproxy_log_level = "error"
11+
imgproxy_max_clients = "10"
12+
imgproxy_allow_origin = "*"
13+
imgproxy_enable_webp_detection = "true"
14+
imgproxy_enforce_webp = "true"
15+
imgproxy_use_etag = "true"
16+
nginx_cache_levels = "1:2"
17+
nginx_cache_keys_zone_size = "256m"
18+
nginx_cache_max_size = "500m"
19+
nginx_cache_inactive = "30d"
20+
nginx_cache_use_temp_path = "off"
21+
nginx_cache_expires = "30d"
22+
23+
[config]
24+
[[config.domains]]
25+
serviceName = "nginx"
26+
port = 80
27+
host = "${main_domain}"
28+
29+
[config.env]
30+
IMGPROXY_KEY = "${imgproxy_key}"
31+
IMGPROXY_SALT = "${imgproxy_salt}"
32+
IMGPROXY_ENABLE_WEBP_DETECTION = "${imgproxy_enable_webp_detection}"
33+
IMGPROXY_ENFORCE_WEBP = "${imgproxy_enforce_webp}"
34+
IMGPROXY_TTL = "${imgproxy_ttl}"
35+
IMGPROXY_DEVELOPMENT_ERRORS_MODE = "false"
36+
IMGPROXY_READ_TIMEOUT = "10"
37+
IMGPROXY_WRITE_TIMEOUT = "10"
38+
IMGPROXY_KEEP_ALIVE_TIMEOUT = "10"
39+
IMGPROXY_DOWNLOAD_TIMEOUT = "5"
40+
IMGPROXY_CONCURRENCY = ""
41+
IMGPROXY_MAX_CLIENTS = "${imgproxy_max_clients}"
42+
IMGPROXY_SO_REUSEPORT = ""
43+
IMGPROXY_USER_AGENT = ""
44+
IMGPROXY_USE_ETAG = "${imgproxy_use_etag}"
45+
IMGPROXY_QUALITY = "${imgproxy_quality}"
46+
IMGPROXY_ALLOWED_SOURCES = "${imgproxy_allowed_sources}"
47+
IMGPROXY_ALLOW_ORIGIN = "${imgproxy_allow_origin}"
48+
IMGPROXY_MAX_SRC_FILE_SIZE = "${imgproxy_max_src_file_size}"
49+
IMGPROXY_MAX_SRC_RESOLUTION = "${imgproxy_max_src_resolution}"
50+
IMGPROXY_LOG_LEVEL = "${imgproxy_log_level}"
51+
NGINX_CACHE_LEVELS = "${nginx_cache_levels}"
52+
NGINX_CACHE_KEYS_ZONE_SIZE = "${nginx_cache_keys_zone_size}"
53+
NGINX_CACHE_MAX_SIZE = "${nginx_cache_max_size}"
54+
NGINX_CACHE_INACTIVE = "${nginx_cache_inactive}"
55+
NGINX_CACHE_USE_TEMP_PATH = "${nginx_cache_use_temp_path}"
56+
NGINX_CACHE_EXPIRES = "${nginx_cache_expires}"
57+
58+
[[config.mounts]]
59+
serviceName = "nginx"
60+
volumeName = "nginx-cache"
61+
mountPath = "/tmp/cache"

meta.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3099,6 +3099,25 @@
30993099
"group-finances"
31003100
]
31013101
},
3102+
{
3103+
"id": "imgproxy",
3104+
"name": "imgproxy",
3105+
"version": "v3.30.1",
3106+
"description": "imgproxy is a fast and secure image processing server, fronted by nginx with built-in response caching for repeated transformations.",
3107+
"logo": "imgproxy.png",
3108+
"links": {
3109+
"github": "https://github.com/imgproxy/imgproxy",
3110+
"website": "https://imgproxy.net/",
3111+
"docs": "https://docs.imgproxy.net/"
3112+
},
3113+
"tags": [
3114+
"images",
3115+
"media",
3116+
"proxy",
3117+
"cdn",
3118+
"caching"
3119+
]
3120+
},
31023121
{
31033122
"id": "immich",
31043123
"name": "Immich",

0 commit comments

Comments
 (0)