Ryu-Sena commited on
Commit
d7a257b
·
verified ·
1 Parent(s): 7e89a92

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -7
Dockerfile CHANGED
@@ -1,11 +1,16 @@
1
  FROM nvidia/cuda:11.1.1-cudnn8-devel-ubuntu18.04
2
 
 
3
  RUN apt-get update && \
4
  apt-get upgrade -y && \
5
- apt-get install -y vim git zip unzip wget mc tmux nano build-essential rsync libgl1
6
 
7
- RUN wget https://mega.nz/linux/repo/xUbuntu_18.04/amd64/megacmd-xUbuntu_18.04_amd64.deb && apt install -y "$PWD/megacmd-xUbuntu_18.04_amd64.deb" && rm "$PWD/megacmd-xUbuntu_18.04_amd64.deb"
 
 
 
8
 
 
9
  ARG USERNAME=user
10
  RUN apt-get install -y sudo && \
11
  addgroup --gid 1000 $USERNAME && \
@@ -19,6 +24,7 @@ USER $USERNAME:$USERNAME
19
  WORKDIR "/home/$USERNAME"
20
  ENV PATH="/home/$USERNAME/miniconda3/bin:/home/$USERNAME/.local/bin:${PATH}"
21
 
 
22
  RUN wget -O /tmp/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh && \
23
  echo "536817d1b14cb1ada88900f5be51ce0a5e042bae178b5550e62f61e223deae7c /tmp/miniconda.sh" > /tmp/miniconda.sh.sha256 && \
24
  sha256sum --check --status < /tmp/miniconda.sh.sha256 && \
@@ -27,25 +33,34 @@ RUN wget -O /tmp/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py3
27
  conda build purge && \
28
  conda init
29
 
 
30
  RUN conda install -n base --override-channels -c conda-forge mamba 'python_abi=*=*cp*'
31
 
32
  ENV TORCH_HOME="/home/$USERNAME/.torch"
33
 
34
-
35
  RUN git clone --recursive https://github.com/Er0manga/Er0mangaSeg.git
36
  RUN git clone --recursive https://github.com/Er0manga/Er0mangaInpaint.git
37
 
 
 
 
 
 
 
 
 
 
38
 
39
- RUN mega-get "https://mega.nz/file/NNQTgR4Q#MuqoCZACOc9pBZ5BzafszLqa0MEnI65KJx4PXqgjV-k" "/home/$USERNAME/Er0mangaSeg/pretrained/"
40
- RUN mega-get "https://mega.nz/file/gRYn2CBJ#HZ73lqn5noX_t2eyfIaDk7sIDfnGQ9gBwClJ6O3VdTE" "/home/$USERNAME/Er0mangaInpaint/pretrained/"
41
  RUN unzip "/home/$USERNAME/Er0mangaInpaint/pretrained/00-30-09.zip" -d "/home/$USERNAME/Er0mangaInpaint/pretrained/"
42
 
 
43
  RUN mamba env create -f "/home/$USERNAME/Er0mangaSeg/env.yml"
44
 
 
45
  RUN mkdir "/home/$USERNAME/app.py"
46
  COPY entrypoint.sh "/home/$USERNAME/"
47
 
48
  EXPOSE 7860
49
 
50
-
51
- ENTRYPOINT ["/bin/bash", "/home/user/entrypoint.sh"]
 
1
  FROM nvidia/cuda:11.1.1-cudnn8-devel-ubuntu18.04
2
 
3
+ # Basic tools installation
4
  RUN apt-get update && \
5
  apt-get upgrade -y && \
6
+ apt-get install -y vim git zip unzip wget mc tmux nano build-essential rsync libgl1 curl
7
 
8
+ # Install MegaCMD from a pre-downloaded package
9
+ COPY megacmd-xUbuntu_18.04_amd64.deb /tmp/
10
+ RUN apt install -y /tmp/megacmd-xUbuntu_18.04_amd64.deb && \
11
+ rm /tmp/megacmd-xUbuntu_18.04_amd64.deb
12
 
13
+ # Set up non-root user
14
  ARG USERNAME=user
15
  RUN apt-get install -y sudo && \
16
  addgroup --gid 1000 $USERNAME && \
 
24
  WORKDIR "/home/$USERNAME"
25
  ENV PATH="/home/$USERNAME/miniconda3/bin:/home/$USERNAME/.local/bin:${PATH}"
26
 
27
+ # Install Miniconda
28
  RUN wget -O /tmp/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh && \
29
  echo "536817d1b14cb1ada88900f5be51ce0a5e042bae178b5550e62f61e223deae7c /tmp/miniconda.sh" > /tmp/miniconda.sh.sha256 && \
30
  sha256sum --check --status < /tmp/miniconda.sh.sha256 && \
 
33
  conda build purge && \
34
  conda init
35
 
36
+ # Install Mamba for faster environment management
37
  RUN conda install -n base --override-channels -c conda-forge mamba 'python_abi=*=*cp*'
38
 
39
  ENV TORCH_HOME="/home/$USERNAME/.torch"
40
 
41
+ # Clone repositories
42
  RUN git clone --recursive https://github.com/Er0manga/Er0mangaSeg.git
43
  RUN git clone --recursive https://github.com/Er0manga/Er0mangaInpaint.git
44
 
45
+ # Download pretrained models using MegaCMD (retry mechanism added)
46
+ RUN mega-login && \
47
+ mega-get "https://mega.nz/file/NNQTgR4Q#MuqoCZACOc9pBZ5BzafszLqa0MEnI65KJx4PXqgjV-k" "/home/$USERNAME/Er0mangaSeg/pretrained/" || \
48
+ echo "Retrying download..." && \
49
+ mega-get "https://mega.nz/file/NNQTgR4Q#MuqoCZACOc9pBZ5BzafszLqa0MEnI65KJx4PXqgjV-k" "/home/$USERNAME/Er0mangaSeg/pretrained/"
50
+
51
+ RUN mega-get "https://mega.nz/file/gRYn2CBJ#HZ73lqn5noX_t2eyfIaDk7sIDfnGQ9gBwClJ6O3VdTE" "/home/$USERNAME/Er0mangaInpaint/pretrained/" || \
52
+ echo "Retrying download..." && \
53
+ mega-get "https://mega.nz/file/gRYn2CBJ#HZ73lqn5noX_t2eyfIaDk7sIDfnGQ9gBwClJ6O3VdTE" "/home/$USERNAME/Er0mangaInpaint/pretrained/"
54
 
 
 
55
  RUN unzip "/home/$USERNAME/Er0mangaInpaint/pretrained/00-30-09.zip" -d "/home/$USERNAME/Er0mangaInpaint/pretrained/"
56
 
57
+ # Create Conda environment
58
  RUN mamba env create -f "/home/$USERNAME/Er0mangaSeg/env.yml"
59
 
60
+ # Prepare app directory
61
  RUN mkdir "/home/$USERNAME/app.py"
62
  COPY entrypoint.sh "/home/$USERNAME/"
63
 
64
  EXPOSE 7860
65
 
66
+ ENTRYPOINT ["/bin/bash", "/home/user/entrypoint.sh"]