diff --git a/ente/Dockerfile b/ente/Dockerfile index cdc9247fc..f63100cea 100644 --- a/ente/Dockerfile +++ b/ente/Dockerfile @@ -8,214 +8,133 @@ # ' - _.' ``'--. # d '---` .-'""` # /` - -############################ -# Stage 0: pull web assets # -############################ -FROM ghcr.io/ente-io/web:latest AS enteweb -# This image already contains the built static outputs for photos/accounts/auth/cast -# under /out plus a default nginx conf. We’ll copy those into the final image. - +#=== Home Assistant Add‑on – ENTE ===# ################# -# 1 Base Image # +# 1 Build Image # ################# ARG BUILD_VERSION + +# Stage 1: Build the web part +FROM node:22-alpine AS builder +WORKDIR /build +COPY . . +ENV NEXT_PUBLIC_ENTE_ENDPOINT=ENTE_API_ORIGIN_PLACEHOLDER +ENV NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT=ENTE_ALBUMS_ORIGIN_PLACEHOLDER +# `yarn install` is flaky on the GitHub arm64 runners otherwise. +RUN yarn config set network-timeout 900000 -g +RUN yarn install +RUN yarn build:photos +RUN yarn build:accounts +RUN yarn build:auth +RUN yarn build:cast + +# Stage 2: Final image with both server and web parts FROM ghcr.io/ente-io/server:latest -######################### -# 2 S6 / base settings # -######################### +################## +# 2 Modify Image # +################## +# S6 settings ENV S6_CMD_WAIT_FOR_SERVICES=1 \ S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \ S6_SERVICES_GRACETIME=0 - USER root - -############################################# -# 3 LSIO helper patch (same pattern as you) # -############################################# +# LSIO helpers (same repo you already use) ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_lsio.sh" "/ha_lsio.sh" ARG CONFIGLOCATION="/config" -RUN chmod 744 /ha_lsio.sh \ - && if grep -qr "lsio" /etc; then /ha_lsio.sh "$CONFIGLOCATION"; fi \ - && rm /ha_lsio.sh - -######################################################## -# 4 Core packages + Postgres server/client + nginx etc # -######################################################## -RUN set -eux \ - && apk update \ - && apk add --no-cache \ - bash curl ca-certificates wget jq sudo tzdata tini \ - postgresql postgresql-client \ - nginx \ - && ln -sf /usr/bin/bash /bin/bash - -################################### -# 5 MinIO server + CLI (per‑arch) # -################################### -ARG TARGETARCH +RUN chmod 744 /ha_lsio.sh && \ + if grep -qr "lsio" /etc; then /ha_lsio.sh "$CONFIGLOCATION"; fi && \ + rm /ha_lsio.sh +# ---------- MinIO & tools (needed by Ente) ---------- +# – server binary + client (`mc`) RUN set -eux; \ - arch="${TARGETARCH:-$(uname -m)}"; \ - case "$arch" in \ - amd64|x86_64) minio_arch="amd64" ;; \ - arm64|aarch64) minio_arch="arm64" ;; \ - *) minio_arch="amd64" ;; \ - esac; \ - curl -fsSL "https://dl.min.io/server/minio/release/linux-${minio_arch}/minio" -o /usr/local/bin/minio; \ - curl -fsSL "https://dl.min.io/client/mc/release/linux-${minio_arch}/mc" -o /usr/local/bin/mc; \ + apk add --no-cache \ + bash curl ca-certificates wget jq tini postgresql15-client; \ + curl -fsSL https://dl.min.io/server/minio/release/linux-amd64/minio -o /usr/local/bin/minio; \ + curl -fsSL https://dl.min.io/client/mc/release/linux-amd64/mc -o /usr/local/bin/mc; \ chmod +x /usr/local/bin/minio /usr/local/bin/mc +RUN apk update && \ + apk add --no-cache \ + lsb-release curl gnupg wget tini jq sudo \ + postgresql postgresql-client nginx -##################################################### -# 6 Copy Ente web static assets from enteweb stage # -##################################################### -# Static output (architecture‑independent) -COPY --from=enteweb /out/ /opt/ente-web/out/ -# We’ll supply our own nginx conf tuned for HA add‑on ports. -COPY <<'EOF' /etc/ente-web/nginx.conf -# Minimal nginx master config that includes our vhosts. -worker_processes auto; -pid /run/nginx.pid; -events { worker_connections 1024; } +# Copy the built web part from the builder stage +COPY --from=builder /build/apps/photos/out /out/photos +COPY --from=builder /build/apps/accounts/out /out/accounts +COPY --from=builder /build/apps/auth/out /out/auth +COPY --from=builder /build/apps/cast/out /out/cast -http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - sendfile on; - keepalive_timeout 65; - - # gzip etc. optional - server_tokens off; - - # Photos (main UI) - port 3000 - server { - listen 3000; - root /opt/ente-web/out/photos; - index index.html; - location / { - try_files $uri $uri/ /index.html; - } - } - - # Accounts - port 3001 - server { - listen 3001; - root /opt/ente-web/out/accounts; - index index.html; - location / { - try_files $uri $uri/ /index.html; - } - } - - # Public albums - port 3002 - server { - listen 3002; - root /opt/ente-web/out/photos; - index index.html; - location / { - try_files $uri $uri/ /index.html; - } - } - - # Auth - port 3003 - server { - listen 3003; - root /opt/ente-web/out/auth; - index index.html; - location / { - try_files $uri $uri/ /index.html; - } - } - - # Cast - port 3004 - server { - listen 3004; - root /opt/ente-web/out/cast; - index index.html; - location / { - try_files $uri $uri/ /index.html; - } - } +# Configure Nginx +COPY <