Add dockerfile and github action

This commit is contained in:
Arnaud_Cayrol 2025-04-13 13:30:36 +02:00
parent c7f5185098
commit 03f015137a
2 changed files with 60 additions and 0 deletions

15
.github/workflow/docker-image.yml vendored Normal file
View file

@ -0,0 +1,15 @@
name: Build and Publish image to Docker Hub
on:
push:
branches:
- main
jobs:
publish_images:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: build image
run: |
docker build . -t arnaudcayrol/immich-selfie-timelapse:latest

45
Dockerfile Normal file
View file

@ -0,0 +1,45 @@
FROM python:3.10-slim
# Install system dependencies required for OpenCV and dlib
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
ffmpeg \
libsm6 \
libxext6 \
libxrender-dev \
libgl1-mesa-glx \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Download the shape predictor model
RUN apt-get update && apt-get install -y wget && \
wget -nd https://github.com/JeffTrain/selfie/raw/master/shape_predictor_68_face_landmarks.dat && \
apt-get remove -y wget && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
# Copy the application code
COPY image_processing.py .
COPY main.py .
COPY templates/ templates/.
COPY compile_timelapse.py .
COPY immich_api.py .
# Create output directory
RUN mkdir -p /app/output
# Expose the port the app runs on
EXPOSE 5000
# Command to run the application
CMD ["python", "main.py"]