Steel / Dockerfile
supernovagateway's picture
Upload folder using huggingface_hub
fb38ec5 verified
ARG NODE_VERSION=22.13.0
FROM node:${NODE_VERSION} AS base
WORKDIR /app
ENV NODE_ENV="production" \
PUPPETEER_CACHE_DIR=/app/.cache \
DISPLAY=:10 \
PATH="/usr/bin:/app/selenium/driver:${PATH}" \
CHROME_BIN=/usr/bin/chromium \
CHROME_PATH=/usr/bin/chromium
LABEL org.opencontainers.image.source="https://github.com/steel-dev/steel-browser"
# Install dependencies
RUN rm -f /etc/apt/apt.conf.d/docker-clean; \
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache; \
apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get -yq dist-upgrade
# Stage 1: Build UI
FROM node:${NODE_VERSION} AS ui-build
WORKDIR /app
# Copy root workspace files for UI build
COPY --link package.json package-lock.json ./
COPY --link ui/ ./ui/
# Install UI dependencies and build with correct base path
RUN npm ci --include=dev -w ui --ignore-scripts
RUN VITE_API_URL="" VITE_WS_URL="" npm run build -w ui -- --base=/ui
# Stage 2: Build API
FROM base AS api-build
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
pkg-config \
python-is-python3 \
xvfb
# Copy root workspace files for API build
COPY --link package.json package-lock.json ./
# Remove or override the prepare script to avoid husky in Docker
RUN npm pkg set scripts.prepare="echo skip husky"
COPY --link api/ ./api/
# Install dependencies for API
RUN npm ci --include=dev --workspace=api
# Install dependencies for recorder extension separately
RUN cd api/extensions/recorder && npm ci --include=dev && cd -
# Build the API package
RUN npm run build -w api
# Build the recorder extension
RUN cd api/extensions/recorder && \
npm run build && \
cd -
# Prune dev dependencies
RUN npm prune --omit=dev -w api
RUN cd api/extensions/recorder && npm prune --omit=dev && cd -
# Stage 3: Production
FROM base AS production
# Install production dependencies
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
wget \
nginx \
gnupg \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst \
fonts-freefont-ttf \
libxss1 \
xvfb \
curl \
unzip \
default-jre \
dbus \
dbus-x11 \
procps \
x11-xserver-utils
# Install Chrome and ChromeDriver
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
wget \
ca-certificates \
curl \
unzip \
# Download and install Chromium
&& apt-get install -y chromium chromium-driver \
# Clean up
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/apt/*
RUN mkdir -p /files
# Copy the built API from api-build stage
COPY --from=api-build /app /app
# Copy the built UI from ui-build stage into the API container
COPY --from=ui-build /app/ui/dist /app/ui/dist
# Copy entrypoint script
COPY --chmod=755 api/entrypoint.sh /app/api/entrypoint.sh
EXPOSE 3000 9223
ENV HOST_IP=localhost \
DBUS_SESSION_BUS_ADDRESS=autolaunch:
ENTRYPOINT ["/app/api/entrypoint.sh"]