diff options
| author | Jan Tuomi <jan@jantuomi.fi> | 2025-06-01 23:17:48 +0300 |
|---|---|---|
| committer | Jan Tuomi <jan@jantuomi.fi> | 2025-06-01 23:17:48 +0300 |
| commit | 0622a93562da6faae2be54ee12008cf13f4327bf (patch) | |
| tree | 177952ecc1672411de134124375a519692ae0927 | |
| parent | 1144b33e33bbf3a05e4e75df8a677c8aa82a3137 (diff) | |
Stuff
| -rw-r--r-- | Dockerfile | 2 | ||||
| -rw-r--r-- | app.py | 5 | ||||
| -rwxr-xr-x | deploy.sh | 14 |
3 files changed, 21 insertions, 0 deletions
@@ -7,4 +7,6 @@ COPY templates /app/templates COPY app.py pyproject.toml .python-version uv.lock /app/ RUN uv sync +EXPOSE 8000 + CMD ["uv", "run", "gunicorn", "--bind", "0.0.0.0:8000", "app:app", "-w", "1"] @@ -67,6 +67,11 @@ def download_and_create_thumbnail(file_id): response = requests.get(url) response.raise_for_status() img = Image.open(BytesIO(response.content)) + + # Convert to RGB if image has alpha channel (RGBA or P) + if img.mode in ("RGBA", "P"): + img = img.convert("RGB") + img.thumbnail((400, 400)) path = os.path.join(THUMBNAIL_DIR, f"{file_id}.jpg") img.save(path, format="JPEG") diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..fa385f4 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Use e.g. `direnv` to set the deploy variables + +set -euxo pipefail + +IMAGE=${OCI_REGISTRY}/gdrive-photo-gallery:latest + +# Build +docker build --progress plain --platform linux/amd64 -t "$IMAGE" . +docker push "$IMAGE" + +# Deploy +ssh "${SSH_SERVER}" "${UPDATE_COMMAND}" |
