cahya commited on
Commit
c26003e
1 Parent(s): e5f8262

update Dockerfile

Browse files
Files changed (4) hide show
  1. Dockerfile +4 -1
  2. app/start.sh +5 -1
  3. default +16 -0
  4. htpasswd +1 -0
Dockerfile CHANGED
@@ -10,13 +10,15 @@ RUN apt-get update && apt-get install -y \
10
  libncurses5-dev libreadline-dev \
11
  && rm -rf /var/lib/apt/lists/* && git lfs install
12
 
 
 
 
13
  RUN chown -R 1000 /var/log/nginx/ /var/lib/nginx/ /run/
14
  USER user
15
  ENV HOME /home/user
16
  ENV PYENV_ROOT $HOME/.pyenv
17
  ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
18
 
19
-
20
  RUN git clone https://github.com/yyuu/pyenv.git $HOME/.pyenv
21
  #RUN curl https://pyenv.run | bash && \
22
  RUN pyenv install 3.8.9 && pyenv global 3.8.9 && pyenv rehash && \
@@ -26,5 +28,6 @@ COPY --chown=user:user ./requirements.txt /home/user/requirements.txt
26
  RUN pip install --no-cache-dir --upgrade -r /home/user/requirements.txt
27
  COPY --chown=user:user ./app /home/user/app
28
  COPY ./default /etc/nginx/sites-available
 
29
  EXPOSE 7860
30
  CMD ["/bin/sh", "/home/user/app/start.sh"]
10
  libncurses5-dev libreadline-dev \
11
  && rm -rf /var/lib/apt/lists/* && git lfs install
12
 
13
+ RUN wget https://github.com/tsl0922/ttyd/releases/download/1.7.3/ttyd.x86_64 -O /usr/local/bin/ttyd && \
14
+ chmod 755 /usr/local/bin/ttyd
15
+
16
  RUN chown -R 1000 /var/log/nginx/ /var/lib/nginx/ /run/
17
  USER user
18
  ENV HOME /home/user
19
  ENV PYENV_ROOT $HOME/.pyenv
20
  ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
21
 
 
22
  RUN git clone https://github.com/yyuu/pyenv.git $HOME/.pyenv
23
  #RUN curl https://pyenv.run | bash && \
24
  RUN pyenv install 3.8.9 && pyenv global 3.8.9 && pyenv rehash && \
28
  RUN pip install --no-cache-dir --upgrade -r /home/user/requirements.txt
29
  COPY --chown=user:user ./app /home/user/app
30
  COPY ./default /etc/nginx/sites-available
31
+ COPY ./htpasswd /etc/nginx
32
  EXPOSE 7860
33
  CMD ["/bin/sh", "/home/user/app/start.sh"]
app/start.sh CHANGED
@@ -1,8 +1,12 @@
1
  #!/usr/bin/env bash
2
  set -e
3
 
4
- cd /home/user/app
5
 
 
 
 
 
6
  nginx
7
 
8
  python whisper.py&
1
  #!/usr/bin/env bash
2
  set -e
3
 
4
+ cd /home/user/
5
 
6
+ /usr/local/bin/ttyd -p 7681 /bin/bash&
7
+
8
+ echo "Console Auth <$CONSOLE_AUTH>"
9
+ echo "$CONSOLE_AUTH" > /etc/nginx/htpasswd
10
  nginx
11
 
12
  python whisper.py&
default CHANGED
@@ -61,6 +61,22 @@ server {
61
  proxy_set_header Connection "upgrade";
62
  }
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
  # pass PHP scripts to FastCGI server
66
  #
61
  proxy_set_header Connection "upgrade";
62
  }
63
 
64
+ location /console/ {
65
+ auth_basic "Console";
66
+ auth_basic_user_file "/etc/nginx/htpasswd";
67
+ proxy_set_header X-WEBAUTH-USER $remote_user;
68
+ proxy_set_header Authorization "";
69
+
70
+ proxy_http_version 1.1;
71
+ proxy_set_header Host $host;
72
+ proxy_set_header X-Real-IP $remote_addr;
73
+ proxy_set_header X-Forwarded-Proto $scheme;
74
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
75
+ proxy_set_header Upgrade $http_upgrade;
76
+ proxy_set_header Connection "upgrade";
77
+ proxy_pass http://localhost:7681/;
78
+ }
79
+
80
 
81
  # pass PHP scripts to FastCGI server
82
  #
htpasswd ADDED
@@ -0,0 +1 @@
 
1
+ # Will be generated