Update Dockerfile
Browse files- Dockerfile +6 -24
Dockerfile
CHANGED
|
@@ -1,34 +1,16 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
USER root
|
| 5 |
-
|
| 6 |
-
# Install extra packages
|
| 7 |
-
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y sudo sshpass dropbear \
|
| 8 |
-
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 9 |
-
|
| 10 |
-
# Set root password
|
| 11 |
-
RUN echo "root:alvin" | chpasswd
|
| 12 |
-
|
| 13 |
-
# Create a non-root user
|
| 14 |
-
RUN useradd -m -u 1000 user \
|
| 15 |
-
&& echo "user:alvin" | chpasswd \
|
| 16 |
-
&& echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/user \
|
| 17 |
-
&& chmod 0440 /etc/sudoers.d/user
|
| 18 |
-
|
| 19 |
-
# Copy app files and make them executable
|
| 20 |
COPY . /app
|
| 21 |
RUN chmod -R 777 /app
|
| 22 |
WORKDIR /app
|
| 23 |
RUN chmod +x ./startup.sh
|
| 24 |
|
| 25 |
-
# Switch to non-root user
|
| 26 |
-
USER user
|
| 27 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
| 28 |
-
|
| 29 |
# Install Python dependencies
|
| 30 |
-
COPY
|
| 31 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 32 |
|
| 33 |
-
# Start
|
| 34 |
CMD ["bash", "-c", "jupyter notebook --ip=0.0.0.0 --port=7860 --no-browser --NotebookApp.token='' --NotebookApp.password=''"]
|
|
|
|
| 1 |
+
# Already existing in base image:
|
| 2 |
+
# USER jovyan
|
| 3 |
+
ENV PATH="/home/jovyan/.local/bin:$PATH"
|
| 4 |
|
| 5 |
+
# Copy files and set permissions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
COPY . /app
|
| 7 |
RUN chmod -R 777 /app
|
| 8 |
WORKDIR /app
|
| 9 |
RUN chmod +x ./startup.sh
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# Install Python dependencies
|
| 12 |
+
COPY ./requirements.txt requirements.txt
|
| 13 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 14 |
|
| 15 |
+
# Start startup.sh then Jupyter Notebook
|
| 16 |
CMD ["bash", "-c", "jupyter notebook --ip=0.0.0.0 --port=7860 --no-browser --NotebookApp.token='' --NotebookApp.password=''"]
|