Spaces:
Runtime error
Runtime error
More playing with 'user' and permissions.
Browse files- Dockerfile +36 -0
Dockerfile
CHANGED
@@ -12,6 +12,10 @@ ARG TARGETPLATFORM
|
|
12 |
RUN useradd -m -u 1000 user
|
13 |
WORKDIR /app
|
14 |
|
|
|
|
|
|
|
|
|
15 |
|
16 |
#RUN apt-get -y update \
|
17 |
# && apt-get install -y software-properties-common \
|
@@ -21,6 +25,38 @@ WORKDIR /app
|
|
21 |
#RUN apt-get -y install python3
|
22 |
#RUN apt-get -y install python3-pip
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
COPY --chown=user ./requirements.txt requirements.txt
|
25 |
|
26 |
USER user
|
|
|
12 |
RUN useradd -m -u 1000 user
|
13 |
WORKDIR /app
|
14 |
|
15 |
+
USER user
|
16 |
+
|
17 |
+
RUN chown -R user:user ./
|
18 |
+
RUN git clone -b energy_star_dev https://github.com/huggingface/optimum-benchmark.git /optimum-benchmark && cd optimum-benchmark && pip install -e .
|
19 |
|
20 |
#RUN apt-get -y update \
|
21 |
# && apt-get install -y software-properties-common \
|
|
|
25 |
#RUN apt-get -y install python3
|
26 |
#RUN apt-get -y install python3-pip
|
27 |
|
28 |
+
|
29 |
+
|
30 |
+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
31 |
+
build-essential \
|
32 |
+
ca-certificates \
|
33 |
+
ccache \
|
34 |
+
curl \
|
35 |
+
python3 \
|
36 |
+
python3-pip \
|
37 |
+
git && \
|
38 |
+
rm -rf /var/lib/apt/lists/*
|
39 |
+
|
40 |
+
# Install conda
|
41 |
+
# translating Docker's TARGETPLATFORM into mamba arches
|
42 |
+
RUN case ${TARGETPLATFORM} in \
|
43 |
+
"linux/arm64") MAMBA_ARCH=aarch64 ;; \
|
44 |
+
*) MAMBA_ARCH=x86_64 ;; \
|
45 |
+
esac && \
|
46 |
+
curl -fsSL -v -o ~/mambaforge.sh -O "https://github.com/conda-forge/miniforge/releases/download/${MAMBA_VERSION}/Mambaforge-${MAMBA_VERSION}-Linux-${MAMBA_ARCH}.sh"
|
47 |
+
RUN chmod +x ~/mambaforge.sh && \
|
48 |
+
bash ~/mambaforge.sh -b -p /opt/conda && \
|
49 |
+
rm ~/mambaforge.sh
|
50 |
+
|
51 |
+
# Install pytorch
|
52 |
+
# On arm64 we exit with an error code
|
53 |
+
RUN case ${TARGETPLATFORM} in \
|
54 |
+
"linux/arm64") exit 1 ;; \
|
55 |
+
*) /opt/conda/bin/conda update -y conda && \
|
56 |
+
/opt/conda/bin/conda install -c "${INSTALL_CHANNEL}" -c "${CUDA_CHANNEL}" -y "python=${PYTHON_VERSION}" "pytorch=$PYTORCH_VERSION" "pytorch-cuda=$(echo $CUDA_VERSION | cut -d'.' -f 1-2)" ;; \
|
57 |
+
esac && \
|
58 |
+
/opt/conda/bin/conda clean -ya
|
59 |
+
|
60 |
COPY --chown=user ./requirements.txt requirements.txt
|
61 |
|
62 |
USER user
|