openweb / Dockerfile
Leon4gr45's picture
Force redeploy with chmod fix
9fe3e06 verified
Raw
History Blame Contribute Delete
2.36 kB
# Stage 1: Build the React dashboard with Bun.
FROM oven/bun:1 AS dashboard-builder
WORKDIR /app/pinchtab/dashboard
COPY pinchtab/dashboard/package.json pinchtab/dashboard/bun.lock ./
RUN bun install --frozen-lockfile
COPY pinchtab/dashboard/ .
RUN bun run build
# Stage 2: Compile the Go binary.
FROM golang:1.25-alpine AS go-builder
RUN apk add --no-cache git
WORKDIR /app/pinchtab
COPY pinchtab/go.mod pinchtab/go.sum ./
RUN go mod download
COPY pinchtab/ .
# Create missing embedded files if they don't exist
RUN touch internal/assets/stealth.js internal/assets/readability.js
COPY --from=dashboard-builder /app/pinchtab/dashboard/dist/ internal/dashboard/dashboard/
RUN mv internal/dashboard/dashboard/index.html internal/dashboard/dashboard/dashboard.html || true
RUN go build -o /pinchtab_bin ./cmd/pinchtab
# Final stage
FROM python:3.12-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
chromium \
chromium-driver \
libnss3 \
libasound2 \
libatk1.0-0 \
libcairo2 \
libcups2 \
libdbus-1-3 \
libexpat1 \
libfontconfig1 \
libgbm1 \
libgcc1 \
libglib2.0-0 \
libgtk-3-0 \
libnspr4 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6 \
ca-certificates \
fonts-liberation \
lsb-release \
xdg-utils \
wget \
curl \
git \
rustc \
cargo \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy and install Python dependencies
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application
COPY . .
# Copy the Pinchtab binary
COPY --from=go-builder /pinchtab_bin /usr/local/bin/pinchtab
# Expose ports (FastAPI/Gradio)
EXPOSE 7860
# Pinchtab
EXPOSE 9867
# Create a non-root user
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONPATH=/app
# Setup entrypoint
# Copy as root, chmod as root, then everything else is fine
USER root
RUN chmod +x entrypoint.sh
USER user
ENTRYPOINT ["./entrypoint.sh"]