Skip to content
Open
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: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ RUN mkdir src && \
cargo build --release && \
rm -rf src

# Build real binary
# Build real binaries (This builds BOTH the app and our healthcheck)
COPY src/ src/
RUN touch src/main.rs src/lib.rs && cargo build --release

Expand Down Expand Up @@ -61,6 +61,12 @@ RUN mkdir -p models && \
# Copy artifacts from build stages
COPY --from=rust-build /app/target/release/immich-timelapse ./
COPY --from=frontend-build /app/frontend/dist/ ./frontend/dist/
# Fixed: Copy the healthcheck from the rust-build stage
COPY --from=rust-build /app/target/release/healthcheck /usr/local/bin/healthcheck

# Set the Internal Healthcheck
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
CMD ["healthcheck"]

# Create non-root user
RUN useradd --create-home --shell /bin/bash timelapse && \
Expand All @@ -69,4 +75,4 @@ RUN useradd --create-home --shell /bin/bash timelapse && \

USER timelapse
EXPOSE 5000
CMD ["./immich-timelapse"]
CMD ["./immich-timelapse"]
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ Use Immich's built-in face recognition to find all photos of a person, then runs
### Immich API key

To access your immich library, this project requires an Immich API key.
Follow this guide to create one: https://immich.app/docs/features/command-line-interface#obtain-the-api-key
Follow this guide to create one: <https://immich.app/docs/features/command-line-interface#obtain-the-api-key>

Here are the features that need to be enabled:

- `asset.download`
- `asset.read`
- `asset.view`
Expand All @@ -61,6 +62,12 @@ services:
volumes:
- ./config:/app/config
- ./output:/app/output
healthcheck:
test: ["CMD", "healthcheck"]
interval: 30s
timeout: 5s
retries: 3
start_period: 60s
restart: unless-stopped
```

Expand All @@ -74,6 +81,11 @@ docker run -d \
-e IMMICH_BASE_URL=http://your_server:2283 \
-v ./config:/app/config \
-v ./output:/app/output \
--health-cmd="healthcheck" \
--health-interval=30s \
--health-timeout=5s \
--health-retries=3 \
--health-start-period=60s \
arnaudcayrol/immich-selfie-timelapse
```

Expand Down Expand Up @@ -101,11 +113,10 @@ Please adjust image brightness filtering, eye aspect ratio etc. for the person y

- The photo filtering is not 100% accurate and will continue to improve.
- Heartfelt thanks to the Immich team and contributors for making this project possible.
- About contribution : When I first created this project, I marked it as open to contributions. I now realize that I don't have as much time as I thought to dedicate to this project. I feel comfortable with issues being opened as it allows me to go through them at my own pace. For pull requests, I cannot guarantee a reasonable time frame for review.
- About contribution : When I first created this project, I marked it as open to contributions. I now realize that I don't have as much time as I thought to dedicate to this project. I feel comfortable with issues being opened as it allows me to go through them at my own pace. For pull requests, I cannot guarantee a reasonable time frame for review.
- Thank you thomaslrg for the discussions around the project.
- Thank you for the 200 GitHub stars !


## License

This project is open source and available under the [MIT License](LICENSE).
14 changes: 14 additions & 0 deletions src/healthcheck.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use std::net::TcpStream;
use std::process;
use std::time::Duration;

fn main() {
// Try to connect to the local server on port 5000
// We give it a 2-second timeout
let address = "127.0.0.1:5000";
if TcpStream::connect_timeout(&address.parse().unwrap(), Duration::from_secs(2)).is_ok() {
process::exit(0); // Exit 0 = Healthy
} else {
process::exit(1); // Exit 1 = Unhealthy
}
}