Skip to content

Instantly share code, notes, and snippets.

@broot5
Last active August 9, 2025 06:32
Show Gist options
  • Select an option

  • Save broot5/846741dc4202381644dd6a4d0e552506 to your computer and use it in GitHub Desktop.

Select an option

Save broot5/846741dc4202381644dd6a4d0e552506 to your computer and use it in GitHub Desktop.
Podman Quadlet Immich v1.137.3
#!/bin/bash
set -e
# Check if .env file exists and load it
if [ ! -f .env ]; then
echo ".env file is missing in the current directory."
exit 1
fi
set -a # Export all variables for envsubst
source .env
set +a
# Template directory path
template_dir="./templates"
# Loop through all .container.template files in the templates directory
for template_file in "$template_dir"/*.container.template; do
# Extract the base filename without the .template extension
base_filename=$(basename "$template_file" .template)
echo "Processing $template_file -> ./$base_filename"
# Perform environment variable substitution and output to the root directory
envsubst < "$template_file" > "./$base_filename"
done
echo "All container templates have been processed."
[Pod] PodName=immich Network=box.network AddHost=immich-server:127.0.0.1 AddHost=immich-machine-learning:127.0.0.1 AddHost=redis:127.0.0.1 AddHost=database:127.0.0.1 [Install] WantedBy=default.target
# templates/immich_machine_learning.container.template
[Container]
Pod=immich.pod
ContainerName=immich_machine_learning
Image=ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION}
AutoUpdate=registry
Volume=model-cache:/cache
EnvironmentFile=.env
# templates/immich_postgres.container.template
[Container]
Pod=immich.pod
ContainerName=immich_postgres
Image=ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0
AutoUpdate=registry
Environment=POSTGRES_PASSWORD=${DB_PASSWORD}
Environment=POSTGRES_USER=${DB_USERNAME}
Environment=POSTGRES_DB=${DB_DATABASE_NAME}
Environment=POSTGRES_INITDB_ARGS=--data-checksums
Volume=${DB_DATA_LOCATION}:/var/lib/postgresql/data:Z
ShmSize=128mb
# templates/immich_redis.container.template
[Container]
Pod=immich.pod
ContainerName=immich_redis
Image=docker.io/valkey/valkey:8-bookworm
AutoUpdate=registry
HealthCmd=redis-cli ping || exit 1
# templates/immich_server.container.template
[Unit]
After=immich_redis.container immich_postgres.container
Requires=immich_redis.container immich_postgres.container
[Container]
Pod=immich.pod
ContainerName=immich_server
Image=ghcr.io/immich-app/immich-server:${IMMICH_VERSION}
AutoUpdate=registry
AddDevice=/dev/dri:/dev/dri
Volume=${UPLOAD_LOCATION}:/data:z
Timezone=local
EnvironmentFile=.env
Timezone=local
EnvironmentFile=.env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment