Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.env
.env.*
!.env.example
data/
secrets/
.git/
.github/
tests/
__pycache__/
*.pyc
63 changes: 41 additions & 22 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,33 +1,52 @@
# Immich
# Immich (>= 3.2)

IMMICH_URL=http://localhost:2283
IMMICH_URL=http://immich-server:2283
# API key with exactly these permissions: album.read, asset.read, asset.download
IMMICH_API_KEY=your_immich_api_key

# Comma-separated album names (must match exactly as shown in Immich)
IMMICH_ALBUMS=Family,Vacation 2024

# Amazon Photos cookies
#
# These come from your browser after logging in to Amazon Photos.
#
# 1. Go to https://www.amazon.com/photos (or your regional TLD)
# 2. Open DevTools → Application → Cookies → https://www.amazon.com
# 3. Copy the values below.
#
# The cookie key names vary by region:
# US accounts: ubid-main, at-main
# Brazil accounts: ubid-acbbr, at-acbbr
# UK accounts: ubid-acbuk, at-acbuk
# etc.
# Amazon Photos target

# Marketplace of your Amazon account: de (default), com, co.uk, fr, it, es, ...
AP_TLD=de
# Album in Amazon Photos that receives the photos (created if missing)
AP_ALBUM_NAME=Echo Show
# trash = remove from album and move to Amazon trash; album_only = only remove from album
AP_DELETE_MODE=trash

# Amazon Photos cookies (from your browser, see README)
#
# IMPORTANT: The at-* cookie is HttpOnly. You may need to grab it from
# DevTools → Network tab → any request to amazon.com → Cookie header.
# Cookies expire periodically (weeks to months) and must be refreshed manually.
# For amazon.de the cookie names are session-id, ubid-acbde and at-acbde.
# They are derived from AP_TLD; set AP_UBID_KEY / AP_AT_KEY only to override.
# Prefer the *_FILE variants (Docker secrets) so values don't show up in `docker inspect`.

AP_SESSION_ID=your_session_id

AP_UBID_KEY=ubid-main
AP_UBID_VALUE=your_ubid_value

AP_AT_KEY=at-main
AP_AT_VALUE=your_at_value
# AP_SESSION_ID_FILE=/run/secrets/ap_session_id
# AP_UBID_VALUE_FILE=/run/secrets/ap_ubid_value
# AP_AT_VALUE_FILE=/run/secrets/ap_at_value
# IMMICH_API_KEY_FILE=/run/secrets/immich_api_key

# Use the User-Agent of the browser you copied the cookies from
# AP_USER_AGENT=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36

# Safety

# Start with a dry run: logs planned uploads/deletions, writes nothing.
DRY_RUN=true
# Refuse to delete more than this share / number of tracked photos in one run
MAX_DELETE_FRACTION=0.2
MAX_DELETE_COUNT=50

# Misc

# IMAGE (default) or IMAGE,VIDEO
SYNC_TYPES=IMAGE
# Files larger than this are skipped
MAX_FILE_MB=200
SYNC_INTERVAL_HOURS=6
# Pinged (GET) after every fully successful run, e.g. healthchecks.io
# HEALTHCHECK_URL=https://hc-ping.com/your-uuid
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto eol=lf
*.sh text eol=lf
Dockerfile text eol=lf
50 changes: 0 additions & 50 deletions .github/workflows/build.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: CI

on:
push:
branches: [main]
pull_request:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-24.04
steps:
# Actions are pinned by full commit SHA; update SHA and comment together.
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false

- name: Unit tests
run: python3 -m unittest discover -s tests -v

- name: Build image (no push)
run: docker build --pull -t immich-amazon-sync:ci .

- name: Image runs as non-root
run: test "$(docker run --rm --entrypoint id immich-amazon-sync:ci -u)" = "10001"
61 changes: 0 additions & 61 deletions .github/workflows/codacy.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.env
data/
secrets/
__pycache__/
*.pyc
17 changes: 14 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
FROM alpine:3.21
# alpine:3.24, pinned by multi-arch index digest. Update both tag and digest together.
FROM alpine:3.24@sha256:294b683cb724975bec92580e1e685676bd4b50bda910ddb8c51d4cabeaec77e6

RUN apk add --no-cache python3
RUN apk add --no-cache python3 \
&& addgroup -S -g 10001 app \
&& adduser -S -D -H -u 10001 -G app -s /sbin/nologin app \
&& mkdir -p /data \
&& chown app:app /data \
&& chmod 700 /data

WORKDIR /app
COPY src/immich_sync.py entrypoint.sh ./
RUN chmod +x entrypoint.sh
RUN chmod 0755 entrypoint.sh && chmod 0644 immich_sync.py

ENV STATE_DIR=/data \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1

USER 10001:10001
VOLUME ["/data"]

ENTRYPOINT ["./entrypoint.sh"]
Loading