Skip to content

Commit

Permalink
Merge pull request #110 from shuttleworth-tech/refactor/dockerfile
Browse files Browse the repository at this point in the history
Optimise dockerfile and add simply build workflow
  • Loading branch information
assafelovic authored Aug 14, 2023
2 parents 882ca91 + 68cf869 commit d48f265
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 17 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
24 changes: 24 additions & 0 deletions .github/workflows/docker-bulid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: GitHub Actions Workflow
run-name: ${{ github.actor }} has started docker build workflow.
on:
pull_request:
types: [opened, edited, ready_for_review]
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@master
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver: docker
- name: Build Dockerfile
uses: docker/build-push-action@v4
with:
push: false
tags: assafelovic/gpt-researcher:latest
file: Dockerfile

34 changes: 17 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
FROM python:3.11.4
FROM python:3.11.4-slim-bullseye as install-browser

RUN apt-get update
RUN apt-get install -y fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libcups2 libdbus-1-3 libdrm2 libgbm1 libgtk-3-0 libgtk-4-1 libnspr4 libnss3 libu2f-udev libvulkan1 libxcomposite1 libxdamage1 libxfixes3 libxkbcommon0 libxrandr2 xdg-utils
RUN apt-get update \
&& apt-get satisfy -y \
"chromium, chromium-driver (>= 115.0)" \
&& chromium --version && chromedriver --version

# Install broswer
RUN apt update
RUN wget https://dl.google.com/linux/deb/pool/main/g/google-chrome-stable/google-chrome-stable_114.0.5735.198-1_amd64.deb
RUN apt install wget
RUN dpkg -i google-chrome-stable_114.0.5735.198-1_amd64.deb
RUN apt-get install -f
RUN google-chrome --version
FROM install-browser as gpt-researcher-install

# Install chrome driver
RUN wget https://chromedriver.storage.googleapis.com/114.0.5735.90/chromedriver_linux64.zip
RUN unzip chromedriver_linux64.zip
RUN mv chromedriver /usr/bin/chromedriver
RUN chown root:root /usr/bin/chromedriver
RUN chmod +x /usr/bin/chromedriver
ENV PIP_ROOT_USER_ACTION=ignore

WORKDIR /app
RUN mkdir /usr/src/app
WORKDIR /usr/src/app

COPY ./requirements.txt ./requirements.txt
RUN pip install -r requirements.txt

FROM gpt-researcher-install AS gpt-researcher

RUN useradd -ms /bin/bash gpt-researcher \
&& chown -R gpt-researcher:gpt-researcher /usr/src/app

USER gpt-researcher

COPY ./ ./

EXPOSE 8000
Expand Down

0 comments on commit d48f265

Please sign in to comment.