-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
47 lines (28 loc) · 1.13 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
38
39
40
41
42
43
44
# Define base image
FROM python:3.9.12-slim
# Set environment variables
ENV buildTag=1.0
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# setting the working directory
WORKDIR /opt/loan-amount-model-project/
# creating a user other than root
RUN adduser --disabled-password --gecos '' loan-user
# install and update system dependencies
RUN apt-get update \
&& apt-get install
# copy project files and folder to our container directory
COPY . loan-amount-model-api /opt/loan-amount-model-project/
COPY . pyproject.toml /opt/loan-amount-model-project/
RUN pip install --no-cache-dir poetry
# updating PATH to include poetry's bin file
ENV PATH="${PATH}:~/.poetry/bin"
RUN poetry install
# install model package through pip
RUN /opt/loan-amount-model-project/.venv/bin/pip install loan_amount_model_package==0.0.7
# Grant ownership and permissions to the user for the application directory
RUN chown -R loan-user:loan-user /opt/loan-amount-model-project/
RUN chmod -R 777 /opt/loan-amount-model-project/
USER loan-user
EXPOSE 8888
CMD ["poetry", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8888" ]