Update Dockerfile
Browse files- Dockerfile +43 -36
Dockerfile
CHANGED
|
@@ -3,10 +3,16 @@
|
|
| 3 |
FROM python:3.9
|
| 4 |
|
| 5 |
RUN useradd -m -u 1000 user
|
| 6 |
-
|
|
|
|
|
|
|
| 7 |
ENV PATH="/home/user/.local/bin:/opt/conda/bin:$PATH"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
|
| 11 |
ARG PYTORCH_VERSION=2.1.0
|
| 12 |
ARG PYTHON_VERSION=3.9 #8.10
|
|
@@ -18,59 +24,60 @@ ARG INSTALL_CHANNEL=pytorch
|
|
| 18 |
# Automatically set by buildx
|
| 19 |
ARG TARGETPLATFORM
|
| 20 |
|
| 21 |
-
|
| 22 |
-
RUN chmod +x /train.sh
|
| 23 |
-
|
| 24 |
-
USER root
|
| 25 |
|
| 26 |
# Update basic dependencies we'll be using.
|
| 27 |
-
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
| 28 |
-
build-essential \
|
| 29 |
-
ca-certificates \
|
| 30 |
-
ccache \
|
| 31 |
-
curl \
|
| 32 |
-
python3 \
|
| 33 |
-
python3-pip \
|
| 34 |
-
git && \
|
| 35 |
-
rm -rf /var/lib/apt/lists/*
|
| 36 |
|
| 37 |
RUN git clone https://github.com/lee-ny/teaching_arithmetic.git /teaching_arithmetic
|
| 38 |
# && cd teaching_arithmetic && pip install -e .
|
| 39 |
#RUN chmod +x /teaching_arithmetic
|
| 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 |
-
USER 1000
|
| 61 |
#COPY --chown=user ./requirements.txt requirements.txt
|
| 62 |
-
COPY ./requirements.txt requirements.txt
|
| 63 |
-
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 64 |
|
| 65 |
#COPY --chown=user teaching_arithmetic /teaching_arithmetic
|
| 66 |
-
|
|
|
|
| 67 |
#COPY . /app
|
| 68 |
-
COPY ./out /out
|
| 69 |
#RUN chmod 777 -R /out
|
| 70 |
|
| 71 |
#RUN chmod +x /out
|
| 72 |
-
COPY ./out/addition_train /out/
|
| 73 |
#RUN chmod +x /teaching_arithmetic/train.py
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
# Expose the secret DEBUG at buildtime and use its value as git remote URL
|
| 76 |
#RUN --mount=type=secret,id=DEBUG,mode=0444,required=true \
|
|
|
|
| 3 |
FROM python:3.9
|
| 4 |
|
| 5 |
RUN useradd -m -u 1000 user
|
| 6 |
+
USER user
|
| 7 |
+
|
| 8 |
+
|
| 9 |
ENV PATH="/home/user/.local/bin:/opt/conda/bin:$PATH"
|
| 10 |
+
ENV HOME="/home/user"
|
| 11 |
+
|
| 12 |
+
WORKDIR $HOME/app
|
| 13 |
+
|
| 14 |
|
| 15 |
+
RUN pip install --no-cache-dir --upgrade pip
|
| 16 |
|
| 17 |
ARG PYTORCH_VERSION=2.1.0
|
| 18 |
ARG PYTHON_VERSION=3.9 #8.10
|
|
|
|
| 24 |
# Automatically set by buildx
|
| 25 |
ARG TARGETPLATFORM
|
| 26 |
|
| 27 |
+
#USER root
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
# Update basic dependencies we'll be using.
|
| 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 |
RUN git clone https://github.com/lee-ny/teaching_arithmetic.git /teaching_arithmetic
|
| 41 |
# && cd teaching_arithmetic && pip install -e .
|
| 42 |
#RUN chmod +x /teaching_arithmetic
|
| 43 |
# Install conda
|
| 44 |
# translating Docker's TARGETPLATFORM into mamba arches
|
| 45 |
+
#RUN case ${TARGETPLATFORM} in \
|
| 46 |
+
# "linux/arm64") MAMBA_ARCH=aarch64 ;; \
|
| 47 |
+
# *) MAMBA_ARCH=x86_64 ;; \
|
| 48 |
+
# esac && \
|
| 49 |
+
# curl -fsSL -v -o ~/mambaforge.sh -O "https://github.com/conda-forge/miniforge/releases/download/${MAMBA_VERSION}/Mambaforge-${MAMBA_VERSION}-Linux-${MAMBA_ARCH}.sh"
|
| 50 |
+
#RUN chmod +x ~/mambaforge.sh && \
|
| 51 |
+
# bash ~/mambaforge.sh -b -p /opt/conda && \
|
| 52 |
+
# rm ~/mambaforge.sh
|
| 53 |
|
| 54 |
# Install pytorch
|
| 55 |
# On arm64 we exit with an error code
|
| 56 |
+
#RUN case ${TARGETPLATFORM} in \
|
| 57 |
+
# "linux/arm64") exit 1 ;; \
|
| 58 |
+
# *) /opt/conda/bin/conda update -y conda && \
|
| 59 |
+
# /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)" ;; \
|
| 60 |
+
# esac && \
|
| 61 |
+
# /opt/conda/bin/conda clean -ya
|
| 62 |
+
|
| 63 |
+
#USER 1000
|
| 64 |
#COPY --chown=user ./requirements.txt requirements.txt
|
| 65 |
+
#COPY ./requirements.txt requirements.txt
|
| 66 |
+
#RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 67 |
|
| 68 |
#COPY --chown=user teaching_arithmetic /teaching_arithmetic
|
| 69 |
+
COPY --chown=user . $HOME/app
|
| 70 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 71 |
#COPY . /app
|
| 72 |
+
#COPY ./out /out
|
| 73 |
#RUN chmod 777 -R /out
|
| 74 |
|
| 75 |
#RUN chmod +x /out
|
| 76 |
+
#COPY ./out/addition_train /out/
|
| 77 |
#RUN chmod +x /teaching_arithmetic/train.py
|
| 78 |
+
#COPY ./train.sh /train.sh
|
| 79 |
+
#RUN chmod +x /train.sh
|
| 80 |
+
|
| 81 |
|
| 82 |
# Expose the secret DEBUG at buildtime and use its value as git remote URL
|
| 83 |
#RUN --mount=type=secret,id=DEBUG,mode=0444,required=true \
|