2023-04-14 10:47:28 +08:00
|
|
|
# Use an official Python base image from the Docker Hub
|
2023-04-19 07:27:29 +08:00
|
|
|
FROM python:3.10-slim
|
2023-04-14 10:47:28 +08:00
|
|
|
|
2023-04-14 10:36:47 +08:00
|
|
|
# Install git
|
|
|
|
RUN apt-get -y update
|
2023-04-16 20:27:14 +08:00
|
|
|
RUN apt-get -y install git chromium-driver
|
2023-04-14 10:36:47 +08:00
|
|
|
|
2023-04-16 05:37:50 +08:00
|
|
|
# Install Xvfb and other dependencies for headless browser testing
|
|
|
|
RUN apt-get update \
|
|
|
|
&& apt-get install -y wget gnupg2 libgtk-3-0 libdbus-glib-1-2 dbus-x11 xvfb ca-certificates
|
|
|
|
|
|
|
|
# Install Firefox / Chromium
|
|
|
|
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
|
|
|
|
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
|
|
|
|
&& apt-get update \
|
|
|
|
&& apt-get install -y chromium firefox-esr
|
|
|
|
|
2023-04-14 10:47:28 +08:00
|
|
|
# Set environment variables
|
|
|
|
ENV PIP_NO_CACHE_DIR=yes \
|
|
|
|
PYTHONUNBUFFERED=1 \
|
|
|
|
PYTHONDONTWRITEBYTECODE=1
|
|
|
|
|
|
|
|
# Create a non-root user and set permissions
|
|
|
|
RUN useradd --create-home appuser
|
|
|
|
WORKDIR /home/appuser
|
|
|
|
RUN chown appuser:appuser /home/appuser
|
|
|
|
USER appuser
|
|
|
|
|
|
|
|
# Copy the requirements.txt file and install the requirements
|
2023-04-17 15:09:13 +08:00
|
|
|
COPY --chown=appuser:appuser requirements.txt .
|
|
|
|
RUN sed -i '/Items below this point will not be included in the Docker Image/,$d' requirements.txt && \
|
|
|
|
pip install --no-cache-dir --user -r requirements.txt
|
2023-04-14 10:47:28 +08:00
|
|
|
|
|
|
|
# Copy the application files
|
2023-04-15 21:59:14 +08:00
|
|
|
COPY --chown=appuser:appuser autogpt/ ./autogpt
|
2023-04-14 10:47:28 +08:00
|
|
|
|
|
|
|
# Set the entrypoint
|
2023-04-16 19:34:48 +08:00
|
|
|
ENTRYPOINT ["python", "-m", "autogpt"]
|