FROM mcr.microsoft.com/playwright:v1.50.1-noble AS rustbuilder
WORKDIR /app
# Get Ubuntu packages
RUN apt-get update && apt-get install -y \
build-essential \
cargo
COPY src/ ./src
COPY Cargo.* .
RUN RUST_LOG=error cargo install --no-default-features --path .
FROM mcr.microsoft.com/playwright:v1.50.1-noble
ARG VERSION=latest
COPY ./build-unpatched.sh .
COPY local.conf /etc/fonts/local.conf
RUN apt-get update && apt-get install -y \
build-essential \
tini curl
RUN ./build-unpatched.sh
# Add Chrome as a user
RUN mkdir -p /usr/src/app \
&& useradd -m chrome \
&& chown -R chrome:chrome /usr/src/app
EXPOSE 9222 6000 9223
USER root
COPY --from=rustbuilder /root/.cargo/bin/chrome_server /usr/local/bin/chrome_server
COPY ./docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
ENV REMOTE_ADDRESS=0.0.0.0
ENV LAUNCH=init
ENV DEFAULT_PORT=9223
ENV DEFAULT_PORT_SERVER=6000
ENV DEFAULT_LAUNCH_NAME=/out/latest/headless-shell/headless-shell
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]