File size: 752 Bytes
8e681e8
401d73f
3ece354
 
 
 
 
401d73f
8e681e8
 
3ece354
8e681e8
 
401d73f
 
8e681e8
 
 
401d73f
8e681e8
 
 
401d73f
8e681e8
3ece354
 
 
8e681e8
 
 
3ece354
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
FROM python:3.8.13 as base

# create user with id 1000 per huggingface
RUN useradd -m -u 1000 user

ENV HOME=/home/user \
	PATH=/home/user/.local/bin:$PATH

FROM base as python-base
RUN curl -sSL https://bootstrap.pypa.io/get-pip.py | python3 -
ENV APP_BASE_PATH="${HOME}/src"
RUN mkdir -p ${APP_BASE_PATH}
ENV PYTHONPATH="${APP_BASE_PATH}:${PYTHONPATH}"


FROM python-base as pip-tools-install
RUN python3 -m pip install pip-tools
WORKDIR ${APP_BASE_PATH}

FROM python-base as pip-install
COPY src/requirements.txt ./requirements.txt
RUN python3 -m pip install -r requirements.txt

FROM pip-install as copy-src
USER user
COPY --chown=user ./src ${APP_BASE_PATH}
WORKDIR ${APP_BASE_PATH}


FROM copy-src as production
CMD ["/home/user/src/run_app.sh"]