-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
37 lines (26 loc) · 1.12 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
FROM ubuntu:latest
RUN apt update -y
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev git
ENV HOME="/root"
ENV PYTHON_VERSION=3.10.4
# Set the working directory to root
WORKDIR ${HOME}
#Install and setup Pyenv
RUN curl https://pyenv.run | bash
ENV PYENV_ROOT=${HOME}/.pyenv
ENV PATH=${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}
RUN pyenv install ${PYTHON_VERSION} -v
RUN pyenv global ${PYTHON_VERSION}
# Set the working directory to the project directory
WORKDIR /app
# Add the project files to the image
ADD src /app/src
ADD pyproject.toml /app
ADD poetry.lock /app
# Install the project dependencies
RUN ${HOME}/.pyenv/versions/3.10.4/bin/pip install poetry
RUN ${HOME}/.pyenv/versions/3.10.4/bin/python -m poetry install --no-dev
# Expose the default port
EXPOSE 8000
# Set the entrypoint to run the Flask app
ENTRYPOINT ["/root/.pyenv/versions/3.10.4/bin/python", "-m","poetry", "run", "uvicorn", "src.main:app", "--port", "8000", "--host", "0.0.0.0"]