Reorganize browser strategy code into separate modules for better maintainability and separation of concerns. Improve Docker implementation with: - Add Alpine and Debian-based Dockerfiles for better container options - Enhance Docker registry to share configuration with BuiltinBrowserStrategy - Add CPU and memory limits to container configuration - Improve error handling and logging - Update documentation and examples BREAKING CHANGE: DockerConfig, DockerRegistry, and DockerUtils have been moved to new locations and their APIs have been updated.
34 lines
1.1 KiB
Docker
34 lines
1.1 KiB
Docker
# ---------- Dockerfile ----------
|
|
FROM alpine:latest
|
|
|
|
# Combine everything in one RUN to keep layers minimal.
|
|
RUN apk update && apk upgrade && \
|
|
apk add --no-cache \
|
|
chromium \
|
|
nss \
|
|
freetype \
|
|
harfbuzz \
|
|
ca-certificates \
|
|
ttf-freefont \
|
|
socat \
|
|
curl && \
|
|
addgroup -S chromium && adduser -S chromium -G chromium && \
|
|
mkdir -p /data && chown chromium:chromium /data && \
|
|
rm -rf /var/cache/apk/*
|
|
|
|
# Copy start script, then chown/chmod in one step
|
|
COPY start.sh /home/chromium/start.sh
|
|
RUN chown chromium:chromium /home/chromium/start.sh && \
|
|
chmod +x /home/chromium/start.sh
|
|
|
|
USER chromium
|
|
WORKDIR /home/chromium
|
|
|
|
# Expose port used by socat (mapping 9222→9223 or whichever you prefer)
|
|
EXPOSE 9223
|
|
|
|
# Simple healthcheck: is the remote debug endpoint responding?
|
|
HEALTHCHECK --interval=30s --timeout=5s --retries=3 CMD curl -f http://localhost:9222/json/version || exit 1
|
|
|
|
CMD ["./start.sh"]
|
|
|