Vscode template
parent
5f41722293
commit
e8a339ea30
@ -1,23 +1,38 @@
|
||||
FROM pytorch/pytorch:2.0.0-cuda11.7-cudnn8-runtime
|
||||
#FROM tensorflow/tensorflow:2.12.0-gpu
|
||||
ENV TZ=Europe/Samara
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
ARG USER
|
||||
ARG GROUP
|
||||
ARG UID
|
||||
ARG GID
|
||||
|
||||
RUN apt update
|
||||
RUN apt install sudo -y
|
||||
RUN sed -i 's/^%sudo.*/%sudo ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers
|
||||
|
||||
RUN groupadd --gid ${GID} ${GROUP}
|
||||
RUN useradd --shell /bin/bash --uid ${UID} --gid ${GID} --create-home ${USER}
|
||||
RUN useradd --shell /bin/bash --uid ${UID} --gid ${GID} -G sudo --create-home ${USER}
|
||||
RUN mkdir /wd
|
||||
RUN chown ${USER}:${GROUP} /wd
|
||||
|
||||
# SYSTEM INITIALIZATION
|
||||
# RUN pip install jupyter
|
||||
# SYSTEM CONFIGURATION
|
||||
RUN apt install vim htop mc curl wget git tree -y
|
||||
RUN curl -fsSL https://code-server.dev/install.sh | sh
|
||||
RUN code-server --install-extension ms-python.python
|
||||
|
||||
|
||||
USER ${USER}
|
||||
|
||||
# USER INITIALIZATION
|
||||
# USER CONFIGURATION
|
||||
# RUN ...
|
||||
|
||||
RUN openssl req -x509 -newkey rsa:4096 -keyout /home/${USER}/key.pem -out /home/${USER}/cert.pem -sha256 -nodes -days 365 -subj "/C=RU/ST=SamaraRegion/L=Samara/O=SSAU/OU=LIAV/CN=vscode.ssau.ru/"
|
||||
RUN mkdir -p /home/${USER}/.config/code-server
|
||||
RUN echo 'bind-addr: 0.0.0.0:8443' >> /home/${USER}/.config/code-server/config.yaml
|
||||
RUN echo "cert: /home/${USER}/cert.pem" >> /home/${USER}/.config/code-server/config.yaml
|
||||
RUN echo "cert-key: /home/${USER}/key.pem" >> /home/${USER}/.config/code-server/config.yaml
|
||||
|
||||
ENV SHELL=/bin/bash
|
||||
SHELL ["/bin/bash", "--login", "-i", "-c"]
|
||||
WORKDIR /wd
|
||||
|
@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
CURDIRNAME=${PWD##*/}
|
||||
|
||||
docker run -d --gpus "device=0" -p 8888:8888 -v $(pwd):/wd --name ${USER}_${CURDIRNAME} ${USER}_${CURDIRNAME}
|
@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
CURDIRNAME=${PWD##*/}
|
||||
|
||||
docker run -it --rm --gpus "device=0" -p 8888:8888 -v $(pwd):/wd --name ${USER}_${CURDIRNAME} ${USER}_${CURDIRNAME}
|
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
CURDIRNAME=${PWD##*/}
|
||||
|
||||
docker stop ${USER}_${CURDIRNAME}_vscode
|
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
CURDIRNAME=${PWD##*/}
|
||||
|
||||
PORT=8400
|
||||
PASSWORD=$(openssl rand -base64 45)
|
||||
docker run \
|
||||
-d \
|
||||
--rm \
|
||||
--gpus "device=0" \
|
||||
-p $PORT:8443 \
|
||||
-v $(pwd):/wd \
|
||||
--shm-size=10gb \
|
||||
--name ${USER}_${CURDIRNAME}_vscode \
|
||||
-e PASSWORD="${PASSWORD}" \
|
||||
${USER}_${CURDIRNAME} \
|
||||
code-server
|
||||
sleep 1
|
||||
docker logs ${USER}_${CURDIRNAME}_vscode
|
||||
echo ""
|
||||
echo "Address: https://$(hostname -i | awk '{ print $1; }'):${PORT}"
|
||||
echo "Password: $PASSWORD"
|
Loading…
Reference in New Issue