dracoox commited on
Commit
b2d79b6
·
verified ·
1 Parent(s): 89104a8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +32 -26
Dockerfile CHANGED
@@ -1,38 +1,44 @@
1
  FROM ubuntu:22.04
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
- RUN apt update && apt install -y tzdata iproute2 net-tools
5
- RUN ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime && \
6
- echo "Etc/UTC" > /etc/timezone && \
7
- dpkg-reconfigure -f noninteractive tzdata
8
-
9
- RUN useradd -m -s /bin/bash user
10
 
 
11
  RUN apt update && apt install -y \
12
- openssh-server \
 
 
 
 
 
13
  sudo \
14
- python3 python3-pip && \
15
- mkdir /var/run/sshd
 
 
 
 
 
 
 
 
 
16
 
17
- RUN echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
18
- RUN echo 'user:yourpassword' | chpasswd
19
- RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config && \
20
- sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
21
 
22
- RUN pip install flask gunicorn
 
23
 
 
24
  WORKDIR /app
 
 
25
  COPY app.py /app
 
 
 
 
 
26
 
27
- EXPOSE 22 7860
28
-
29
- CMD bash -c '\
30
- HOST_IP=$(ip route | grep default | awk '\''{print $3}'\''); \
31
- echo "======================================"; \
32
- echo "Detected host IP: $HOST_IP"; \
33
- echo "SSH login command:"; \
34
- echo "ssh user@$HOST_IP -p 2222"; \
35
- echo "Password: yourpassword"; \
36
- echo "======================================"; \
37
- service ssh start; \
38
- gunicorn --bind 0.0.0.0:7860 app:app'
 
1
  FROM ubuntu:22.04
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
 
 
 
 
 
 
4
 
5
+ # Install required packages
6
  RUN apt update && apt install -y \
7
+ tzdata \
8
+ iproute2 \
9
+ net-tools \
10
+ curl \
11
+ iptables \
12
+ ca-certificates \
13
  sudo \
14
+ python3 \
15
+ python3-pip \
16
+ && ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime \
17
+ && echo "Etc/UTC" > /etc/timezone \
18
+ && dpkg-reconfigure -f noninteractive tzdata \
19
+ && rm -rf /var/lib/apt/lists/*
20
+
21
+ # Create user
22
+ RUN useradd -m -s /bin/bash user && \
23
+ echo 'user:yourpassword' | chpasswd && \
24
+ echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
25
 
26
+ # Install Tailscale
27
+ RUN curl -fsSL https://tailscale.com/install.sh | sh
 
 
28
 
29
+ # Install Python dependencies
30
+ RUN pip3 install flask gunicorn
31
 
32
+ # Set working directory
33
  WORKDIR /app
34
+
35
+ # Copy app files
36
  COPY app.py /app
37
+ COPY run.sh /app
38
+ RUN chmod +x /app/run.sh
39
+
40
+ # Expose Flask port
41
+ EXPOSE 7860
42
 
43
+ # Default command
44
+ CMD ["/app/run.sh"]