meg HF staff commited on
Commit
4e96fe8
·
verified ·
1 Parent(s): c2011a2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -27
Dockerfile CHANGED
@@ -9,18 +9,12 @@ ARG INSTALL_CHANNEL=pytorch
9
  # Automatically set by buildx
10
  ARG TARGETPLATFORM
11
 
12
-
13
- #ENV HOME=/home/user \
14
- # PATH=/home/user/.local/bin:/opt/conda/bin:$PATH
15
 
16
  ENV PATH=/opt/conda/bin:$PATH
17
 
18
- RUN mkdir -p .cache
19
- #RUN mkdir -p data
20
- # I'm not sure how to allow later python files used here to write to .cache without making it world-writeable.
21
- RUN chmod 777 -R .cache
22
- #RUN chmod 777 -R data
23
-
24
  RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
25
  build-essential \
26
  ca-certificates \
@@ -51,29 +45,14 @@ RUN case ${TARGETPLATFORM} in \
51
  esac && \
52
  /opt/conda/bin/conda clean -ya
53
 
54
- COPY ./requirements.txt requirements.txt
55
  RUN pip install -r requirements.txt
56
-
57
  RUN git clone -b energy_star_dev https://github.com/huggingface/optimum-benchmark.git /optimum-benchmark && cd optimum-benchmark && pip install -e .
58
 
59
- COPY ./*.txt /
60
- COPY ./.cache /.cache
61
- COPY ./entrypoint.sh /entrypoint.sh
62
- COPY ./pause_space.py /pause_space.py
63
- COPY ./parse_requests.py /parse_requests.py
64
- COPY ./process_runs.py /process_runs.py
65
- COPY ./app/runs /app/runs
66
-
67
- RUN chmod 777 *.py
68
- RUN chmod 777 -R /app/runs
69
- RUN chmod 777 -R /.cache
70
- RUN chmod 777 /attempts.txt
71
- RUN chmod 777 /failed_attempts.txt
72
- RUN chmod +x /entrypoint.sh
73
-
74
  # Expose the secret token at buildtime and use its value as git remote URL
75
  RUN --mount=type=secret,id=BULK_ENERGY_TOKEN,mode=0444,required=true \
76
  git init && \
77
  git remote add origin $(cat /run/secrets/BULK_ENERGY_TOKEN)
78
 
79
- CMD ["uvicorn", "app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
9
  # Automatically set by buildx
10
  ARG TARGETPLATFORM
11
 
12
+ RUN useradd -m -u 1000 user
13
+ USER user
14
+ WORKDIR /app
15
 
16
  ENV PATH=/opt/conda/bin:$PATH
17
 
 
 
 
 
 
 
18
  RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
19
  build-essential \
20
  ca-certificates \
 
45
  esac && \
46
  /opt/conda/bin/conda clean -ya
47
 
 
48
  RUN pip install -r requirements.txt
 
49
  RUN git clone -b energy_star_dev https://github.com/huggingface/optimum-benchmark.git /optimum-benchmark && cd optimum-benchmark && pip install -e .
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  # Expose the secret token at buildtime and use its value as git remote URL
52
  RUN --mount=type=secret,id=BULK_ENERGY_TOKEN,mode=0444,required=true \
53
  git init && \
54
  git remote add origin $(cat /run/secrets/BULK_ENERGY_TOKEN)
55
 
56
+
57
+ COPY --chown=user . /app
58
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]