rrevo commited on
Commit
9e6044b
·
1 Parent(s): 3793837
Files changed (1) hide show
  1. Dockerfile +10 -6
Dockerfile CHANGED
@@ -1,21 +1,25 @@
1
  FROM python:3.11
2
 
3
- WORKDIR /code
 
4
 
5
- RUN mkdir -p /code/.pdm_cache && mkdir -p /code/.transformers_cache
 
6
 
7
- ENV PDM_CACHE_DIR /code/.pdm_cache/
8
 
9
- COPY server/pdm.lock server/pyproject.toml ./
 
 
 
10
 
11
  RUN pip install pdm
12
 
13
  RUN pdm install
14
 
15
- COPY server/ ./
16
 
17
  ENV DEVICE cuda:0
18
  ENV ATTN_IMPLEMENTATION flash_attention_2
19
- ENV TRANSFORMERS_CACHE /code/.transformers_cache/
20
 
21
  ENTRYPOINT [ "./entrypoint.sh" ]
 
1
  FROM python:3.11
2
 
3
+ RUN useradd -m -u 1000 user
4
+ USER user
5
 
6
+ ENV HOME=/home/user \
7
+ PATH=/home/user/.local/bin:$PATH
8
 
9
+ WORKDIR $HOME/code
10
 
11
+ ENV PDM_CACHE_DIR $HOME/code/.pdm_cache/
12
+ ENV HF_HOME $HOME/code/.hf_home/
13
+
14
+ COPY --chown=user server/pdm.lock server/pyproject.toml ./
15
 
16
  RUN pip install pdm
17
 
18
  RUN pdm install
19
 
20
+ COPY --chown=user server/ ./
21
 
22
  ENV DEVICE cuda:0
23
  ENV ATTN_IMPLEMENTATION flash_attention_2
 
24
 
25
  ENTRYPOINT [ "./entrypoint.sh" ]