From b25fbf01c6967ad2f25a2f4b785129a1149ce58a Mon Sep 17 00:00:00 2001
From: Maciej Wielgosz <maciej.wielgosz@nibio.no>
Date: Sat, 21 Jan 2023 18:03:13 +0000
Subject: [PATCH] update Dockerfile for Oracle cloud deploy

---
 .dockerignore    |   2 ++
 Dockerfile       |  73 +++++++++++------------------------------------
 build.sh         |   3 ++
 requirements.txt | Bin 2150 -> 2166 bytes
 run.sh           |   2 ++
 5 files changed, 24 insertions(+), 56 deletions(-)
 create mode 100644 .dockerignore
 create mode 100755 build.sh
 create mode 100755 run.sh

diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..515b24a
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+.git
+build.sh
diff --git a/Dockerfile b/Dockerfile
index 430fe40..0701571 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,64 +1,16 @@
 FROM nvidia/cuda:11.2.1-cudnn8-runtime-ubuntu20.04
 
-RUN ln -fs /usr/share/zoneinfo/Europe/Warsaw /etc/localtime
-RUN apt-get update && apt-get install -y --no-install-recommends \
-    git \
-    language-pack-en-base \
-    openssh-server \
-    openssh-client \
-    python3.6 \
-    python3-pip \
-    python3-setuptools \
-    ssh \
-    curl \
-    sudo \
-    vim \
-    wget \
-    less \
-    libglib2.0-0 \
-    libsm6 \
-    libxext6 \
-    libxrender-dev \
-    libsndfile1 \
-    && rm -rf /var/lib/apt/lists/* \
-    && python3 -m pip install --no-cache-dir --upgrade \
-    autopep8 \
-    doc8 \
-    docutils \
-    ipython \
-    pip \
-    pylint \
-    pytest \
-    rope \
-    setuptools \
-    wheel \
-    torch \
-    tqdm \
-    pandas
-    
-# Create non-root user
-ARG UID=1000
-ARG GID=1000
-ARG USERNAME=nibio
-ENV HOME /home/${USERNAME}
-
-RUN groupadd -g ${GID} ${USERNAME} \
-    && useradd -ms /bin/bash -u ${UID} -g ${GID} -G sudo ${USERNAME} \
-    && echo "${USERNAME}:${USERNAME}" | chpasswd 
-
-COPY ./check_print.py $HOME
-
-#USER $USERNAME
-WORKDIR $HOME
-
 # install conda
 ARG UBUNTU_VER=20.04
 ARG CONDA_VER=latest
 ARG OS_TYPE=x86_64
 
-RUN mkdir conda_installation && cd conda_installation
-RUN curl -LO "http://repo.continuum.io/miniconda/Miniconda3-${CONDA_VER}-Linux-${OS_TYPE}.sh"
-RUN bash Miniconda3-latest-Linux-x86_64.sh -p /miniconda -b
+RUN apt-get update && apt-get install -y --no-install-recommends curl
+
+RUN curl -LO "http://repo.continuum.io/miniconda/Miniconda3-${CONDA_VER}-Linux-${OS_TYPE}.sh" && \
+    bash Miniconda3-${CONDA_VER}-Linux-${OS_TYPE}.sh -p /miniconda -b && \
+    rm Miniconda3-${CONDA_VER}-Linux-${OS_TYPE}.sh 
+
 RUN /miniconda/bin/conda update conda 
 
 RUN /miniconda/bin/conda init bash
@@ -70,6 +22,15 @@ RUN echo "conda activate pdal-env" >> ~/.bashrc
 
 RUN conda install -c conda-forge pdal python-pdal
 
-#CMD ["echo", "'just test print bash'" ]
+COPY requirements.txt /app/requirements.txt
+RUN pip install --no-cache -r /app/requirements.txt
+
+COPY . /app
+
+ENTRYPOINT ["/miniconda/bin/conda", "run", "-n", "pdal-env", "python", "/app/run.py"]
+
+WORKDIR /app
+
+CMD ["--help" ]
+
 
-CMD ["python3", "check_print.py" ]
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..0ba2e21
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,3 @@
+#/bin/sh
+
+docker build -t nibio/cuda-vscode-conda:latest .
diff --git a/requirements.txt b/requirements.txt
index 5eee61352f1e6c101f7c30e1d72d92191974885f..9e761f979fd0727e61cbb3784f62c165ce705528 100644
GIT binary patch
delta 24
fcmaDR@J(Pt8izmuLnT8cLn1>iLk<Hk0~Z4TVaf&G

delta 7
Ocmew+@JwJs8V3Ll!vh-t

diff --git a/run.sh b/run.sh
new file mode 100755
index 0000000..90fc3c2
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+docker run --mount type=bind,src='/home/opc/git_repos/instance_segmentation_classic/config/config.yaml',dst='/app/current_config.yaml' --rm nibio/cuda-vscode-conda:latest --path_to_config_file /app/current_config.yaml
-- 
GitLab