From 7be7d32d58c758d996486aeb5625027dbb85650a Mon Sep 17 00:00:00 2001 From: Bas Dado Date: Thu, 29 May 2025 21:21:56 +0200 Subject: [PATCH] [TASK] Added Dockerfile to build docker container --- .aiignore | 10 ++++++++++ Dockerfile | 23 +++++++++++++++++++++++ README.md | 30 +++++++++++++++++++++++++++++- 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 .aiignore create mode 100644 Dockerfile diff --git a/.aiignore b/.aiignore new file mode 100644 index 0000000..4799368 --- /dev/null +++ b/.aiignore @@ -0,0 +1,10 @@ +# An .aiignore file follows the same syntax as a .gitignore file. +# .gitignore documentation: https://git-scm.com/docs/gitignore +# Junie will ask for explicit approval before view or edit the file or file within a directory listed in .aiignore. +# Only files contents is protected, Junie is still allowed to view file names even if they are listed in .aiignore. +# Be aware that the files you included in .aiignore can still be accessed by Junie in two cases: +# - If Brave Mode is turned on. +# - If a command has been added to the Allowlist — Junie will not ask for confirmation, even if it accesses - files and folders listed in .aiignore. +/export +result.txt +.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1528ce7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM python:3.11-slim + +WORKDIR /app + +# Copy requirements and install dependencies +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +# Copy the application code +COPY . . + +# Create the export directory +RUN mkdir -p /app/export + +# Set environment variables +ENV TARGET_DIR=/app/export +# IMMICH_HOST and IMMICH_API_KEY should be provided at runtime + +# Set the entrypoint +ENTRYPOINT ["python", "immich-export.py"] + +# Default command (can be overridden) +CMD [] diff --git a/README.md b/README.md index 924c596..f759d6a 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,39 @@ Script to export immich data as a structured folder. Useful if you want to brows - [x] Create folders like "Misc {{year}}" for photos that are not in albums - [ ] Move (or rename?) photos that are deleted in Immich but exist on the local disk -- [ ] Dockerize the tool so it's easy to run on the server +- [x] Dockerize the tool so it's easy to run on the server - [ ] Stretch: Preserve metadata (e.g. file creation times) - [ ] Stretch: directly sync to Proton Drive (skipping the local filesystem) +## Usage + +### Docker + +You can build and run this tool using Docker: + +```bash +# Build the Docker image +docker build -t immich-to-cloud-exporter . + +# Run the container +docker run -it --rm \ + -e IMMICH_HOST=http://your-immich-server:2283/api \ + -e IMMICH_API_KEY=your_api_key \ + -v /path/to/local/export:/app/export \ + immich-to-cloud-exporter +``` + +To run with the dry-run flag: + +```bash +docker run --rm \ + -e IMMICH_HOST=http://your-immich-server:2283/api \ + -e IMMICH_API_KEY=your_api_key \ + -v /path/to/local/export:/app/export \ + immich-to-cloud-exporter --dry-run +``` + ## Development ### Generate OpenAPI spec