-
Notifications
You must be signed in to change notification settings - Fork 44.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the docker setup consistent with local #1199
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,38 +1,26 @@ | ||||||||||||
# Use an official Python base image from the Docker Hub | ||||||||||||
FROM python:3.10-slim | ||||||||||||
|
||||||||||||
# Install git | ||||||||||||
RUN apt-get -y update | ||||||||||||
RUN apt-get -y install git chromium-driver | ||||||||||||
RUN apt-get update | ||||||||||||
RUN apt-get install -y git chromium-driver wget gnupg2 libgtk-3-0 libdbus-glib-1-2 dbus-x11 xvfb ca-certificates | ||||||||||||
|
||||||||||||
# Install Xvfb and other dependencies for headless browser testing | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment was actually useful imo, can you add it back in some form? |
||||||||||||
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 | ||||||||||||
Comment on lines
6
to
9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Chromium is already installed by
Suggested change
|
||||||||||||
|
||||||||||||
# 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 | ||||||||||||
WORKDIR /tmp | ||||||||||||
COPY requirements.txt . | ||||||||||||
|
||||||||||||
# Chop out the part of requirements.txt not intended for the docker image | ||||||||||||
RUN sed -i '/Items below this point will not be included in the Docker Image/,$d' requirements.txt | ||||||||||||
RUN pip install -r requirements.txt | ||||||||||||
|
||||||||||||
# Copy the requirements.txt file and install the requirements | ||||||||||||
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 | ||||||||||||
WORKDIR /app | ||||||||||||
|
||||||||||||
# Copy the application files | ||||||||||||
COPY --chown=appuser:appuser autogpt/ ./autogpt | ||||||||||||
COPY . . | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need all files in the container build. |
||||||||||||
|
||||||||||||
# Set the entrypoint | ||||||||||||
ENTRYPOINT ["python", "-m", "autogpt"] |
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -10,9 +10,8 @@ services: | |||||||||||||||
env_file: | ||||||||||||||||
- .env | ||||||||||||||||
Comment on lines
10
to
11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since
Suggested change
|
||||||||||||||||
volumes: | ||||||||||||||||
- "./autogpt:/app" | ||||||||||||||||
- ".env:/app/.env" | ||||||||||||||||
profiles: ["exclude-from-up"] | ||||||||||||||||
- "./:/app" | ||||||||||||||||
profiles: ["exclude-from-up"] # Run and attach to container instead with: `docker-compose run auto-gpt` | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
|
||||||||||||||||
redis: | ||||||||||||||||
image: "redis/redis-stack-server:latest" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer keeping X11 and the Xvfb etc out of the docker image, as docker containers are headless anyways, and clearly state in the docs that only headless browsing is supported in the docker container. Headless browsing should work fine since #1473.