Praneeth Yerrapragada commited on
Commit
1bcc93c
·
1 Parent(s): 6a8f4c1

build: fix backend dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -10
Dockerfile CHANGED
@@ -4,28 +4,27 @@ RUN useradd -m -u 1000 user
4
  USER user
5
  ENV HOME=/home/user \
6
  POETRY_HOME=/opt/poetry \
 
7
  PATH="/home/user/.local/bin:$POETRY_HOME/bin:$PATH"
8
  WORKDIR $HOME/app
9
 
10
- ENV PYTHONPATH=/app
11
 
12
  # Install Poetry
13
- RUN curl -sSL https://install.python-poetry.org | python && \
14
- cd /usr/local/bin && \
15
- ln -s /opt/poetry/bin/poetry && \
16
- poetry config virtualenvs.create false
17
 
18
  # Install Chromium for web loader
19
  # Can disable this if you don't use the web loader to reduce the image size
20
- RUN apt update && apt install -y chromium chromium-driver
21
 
22
  # Install dependencies
23
- COPY ./pyproject.toml ./poetry.lock* /app/
24
- RUN poetry install --no-root --no-cache --only main
25
 
26
  # ====================================
27
- FROM build as release
28
 
29
  COPY . .
30
 
31
- CMD ["python", "main.py"]
 
4
  USER user
5
  ENV HOME=/home/user \
6
  POETRY_HOME=/opt/poetry \
7
+ POETRY_CACHE_DIR=/tmp/poetry_cache \
8
  PATH="/home/user/.local/bin:$POETRY_HOME/bin:$PATH"
9
  WORKDIR $HOME/app
10
 
11
+ ENV PYTHONPATH=$HOME/app
12
 
13
  # Install Poetry
14
+ RUN --mount=type=cache,mode=0755,target=/root/.cache/pip pip install poetry
15
+ RUN poetry config virtualenvs.create false
 
 
16
 
17
  # Install Chromium for web loader
18
  # Can disable this if you don't use the web loader to reduce the image size
19
+ # RUN apt update && apt install -y chromium chromium-driver
20
 
21
  # Install dependencies
22
+ COPY ./pyproject.toml ./poetry.lock* $HOME/app/
23
+ RUN --mount=type=cache,target=$POETRY_CACHE_DIR poetry install --no-root --without dev
24
 
25
  # ====================================
26
+ FROM python:3.11-slim-buster as release
27
 
28
  COPY . .
29
 
30
+ ENTRYPOINT ["python", "main.py"]