69 lines
2.5 KiB
Docker
69 lines
2.5 KiB
Docker
# ═══════════════════════════════════════════════════════════════════════
|
|
# STAGE 1: Dependencies
|
|
# Install only production dependencies
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
FROM oven/bun:1.2-slim AS deps
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json bun.lock ./
|
|
RUN bun install --production --frozen-lockfile
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
# STAGE 2: Runtime
|
|
# Minimal image with Chromium + Bun runtime only
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
FROM debian:bookworm-slim AS runtime
|
|
|
|
LABEL org.opencontainers.image.source="https://gitea.bigoscloud.com/biggy/samsung-tv-server" \
|
|
org.opencontainers.image.title="Samsung TV Server" \
|
|
org.opencontainers.image.description="Samsung TV Server — Bun runtime (optimized)" \
|
|
org.opencontainers.image.licenses="MIT"
|
|
|
|
WORKDIR /app
|
|
|
|
# Install Chromium with aggressive cleanup
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
chromium \
|
|
ca-certificates \
|
|
fonts-liberation \
|
|
libasound2 \
|
|
libatk-bridge2.0-0 \
|
|
libatk1.0-0 \
|
|
libatspi2.0-0 \
|
|
libcups2 \
|
|
libdbus-1-3 \
|
|
libdrm2 \
|
|
libgbm1 \
|
|
libgtk-3-0 \
|
|
libnspr4 \
|
|
libnss3 \
|
|
libxcomposite1 \
|
|
libxdamage1 \
|
|
libxfixes3 \
|
|
libxkbcommon0 \
|
|
libxrandr2 \
|
|
xdg-utils && \
|
|
apt-get clean && \
|
|
rm -rf /var/lib/apt/lists/* /var/cache/apt/* /var/log/apt/* /tmp/*
|
|
|
|
# Copy Bun binary from official image (lighter than full install)
|
|
COPY --from=oven/bun:1.2-slim /usr/local/bin/bun /usr/local/bin/bun
|
|
COPY --from=oven/bun:1.2-slim /usr/local/bin/bunx /usr/local/bin/bunx
|
|
|
|
# Copy dependencies from deps stage
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
|
|
# Copy application code
|
|
COPY package.json bun.lock ./
|
|
COPY src/ ./src/
|
|
COPY public/ ./public/
|
|
|
|
# Create data directory for SQLite
|
|
RUN mkdir -p /app/data
|
|
|
|
EXPOSE 3099
|
|
|
|
CMD ["bun", "run", "start"]
|