Skip to content

Commit

Permalink
Merge branch 'main' into add-second-hand-offers
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKluge authored Jul 9, 2024
2 parents 09929bb + 1c08188 commit 7e34606
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lens-gpt-backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y \
chromium \
chromium-driver \
xvfb \
x11vnc \
fluxbox \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -39,6 +42,3 @@ EXPOSE 5000

# Set the default command to execute the Flask app using Poetry
CMD ["poetry", "run", "python", "-m", "lens_gpt_backend.main"]



8 changes: 7 additions & 1 deletion lens-gpt-backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ docker build -t lens-gpt-backend .
To run the docker image, run the following command:

```bash
docker run -p 5000:5000 lens-gpt-backend
docker run \
--name your_container_name \
-e DISPLAY=:99 \
-p 5000:5000 \
lens-gpt-backend \
/bin/bash -c "Xvfb :99 -screen 0 1280x1024x24 & poetry run python -m lens_gpt_backend.main"

```


Expand Down
3 changes: 1 addition & 2 deletions lens-gpt-backend/lens_gpt_backend/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
from lens_gpt_backend.utils.product import Product
from lens_gpt_backend.utils.result_queue import ResultQueue

app = Flask(__name__, static_folder=os.path.abspath('templates'))

app = Flask(__name__, static_folder=os.path.abspath('./templates'))
CORS(app)
cache = Cache(".cache")
if not os.path.exists("tmp"):
os.makedirs("tmp")
Expand Down
6 changes: 3 additions & 3 deletions lens-gpt-backend/lens_gpt_backend/utils/driver_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ def _init_new_driver() -> DriverWrapper:
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--disable-gpu')
options.add_argument('--headless')


# Check if running in Docker by looking for the .dockerenv file
if os.path.exists('/.dockerenv'):
options.add_argument('--headless')
service = Service(executable_path="/usr/bin/chromedriver")
driver = webdriver.Chrome(options=options, service=service)
else:
# options.add_argument('--headless')
options.add_argument('--headless')
driver = webdriver.Chrome(options=options)

wait = WebDriverWait(driver, 10) # Timeout after 10 seconds
Expand Down

0 comments on commit 7e34606

Please sign in to comment.