soxogvv commited on
Commit
d8eb8a5
Β·
verified Β·
1 Parent(s): a48b9da

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -37
Dockerfile CHANGED
@@ -1,75 +1,57 @@
1
  # ─── Base ──────────────────────────────────────────────────────────────────
2
  FROM ubuntu:22.04
3
 
4
- # Prevent interactive prompts from any apt/dpkg step
5
  ENV DEBIAN_FRONTEND=noninteractive
6
  ENV PYTHONUNBUFFERED=1
7
  ENV PIP_ROOT_USER_ACTION=ignore
8
 
9
- # ─── System packages ────────────────────────────────────────────────────────
10
- # All tools a user might need from a web terminal
11
  RUN apt-get update && apt-get install -y --no-install-recommends \
12
- # Shell & editors
13
  bash bash-completion nano vim less \
14
- # Process & session management
15
  tmux screen htop procps \
16
- # Python
17
  python3 python3-pip python3-venv python3-dev \
18
- # Node / npm (latest LTS via NodeSource added below)
19
- nodejs npm \
20
- # Network tools
21
  curl wget git netcat-openbsd dnsutils iputils-ping \
22
- # Build tools (for pip packages that compile)
23
  build-essential gcc g++ make \
24
- # Archive tools
25
  zip unzip tar gzip bzip2 xz-utils \
26
- # Text / data utils
27
  jq bc sed gawk \
28
- # SSL
29
- ca-certificates \
30
- # Locale
31
- locales \
32
  && rm -rf /var/lib/apt/lists/*
33
 
34
  # ─── Locale ─────────────────────────────────────────────────────────────────
35
  RUN locale-gen en_US.UTF-8
36
  ENV LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
37
 
38
- # ─── Node.js LTS (v20) via NodeSource ───────────────────────────────────────
39
- # Gives a modern npm without the outdated Ubuntu package
40
  RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
41
  && apt-get install -y nodejs \
42
- && rm -rf /var/lib/apt/lists/*
 
43
 
44
- # ─── Python virtual environment ──────────────────────────────────────────────
45
- # Keeps system Python clean; no --break-system-packages ever needed
46
  RUN python3 -m venv /opt/venv
47
  ENV PATH="/opt/venv/bin:$PATH"
48
- # Make pip fast and quiet
49
  RUN pip install --upgrade pip setuptools wheel
50
 
51
- # ─── App setup ──────────────────────────────────────────────────────────────
52
  RUN mkdir -p /workspace /app && chmod 777 /workspace
53
-
54
  WORKDIR /app
55
 
56
- # Copy & install Python requirements first (layer cache)
57
  COPY requirements.txt .
58
  RUN pip install --no-cache-dir -r requirements.txt
59
 
60
- # Copy application source
61
  COPY . .
62
 
63
- # ─── Bash config for /workspace ─────────────────────────────────────────────
64
- RUN echo 'export PS1="\[\e[38;5;40m\]\u\[\e[0m\]@\[\e[38;5;33m\]webterminal\[\e[0m\]:\[\e[38;5;33m\]\w\[\e[0m\]\$ "' >> /root/.bashrc \
65
- && echo 'alias ll="ls -lah --color=auto"' >> /root/.bashrc \
66
- && echo 'alias la="ls -A"' >> /root/.bashrc \
67
- && echo 'alias py="python3"' >> /root/.bashrc \
68
- && echo 'cd /workspace' >> /root/.bashrc
 
 
69
 
70
- # ─── Port ──────��────────────────────────────────────────────────────────────
71
  EXPOSE 7860
72
-
73
- # ─── Run ────────────────────────────────────────────────────────────────────
74
- # gevent handles async WebSockets efficiently
75
- CMD ["python", "app.py"]
 
1
  # ─── Base ──────────────────────────────────────────────────────────────────
2
  FROM ubuntu:22.04
3
 
 
4
  ENV DEBIAN_FRONTEND=noninteractive
5
  ENV PYTHONUNBUFFERED=1
6
  ENV PIP_ROOT_USER_ACTION=ignore
7
 
8
+ # ─── System packages (NO nodejs/npm here β€” installed via NodeSource below) ──
 
9
  RUN apt-get update && apt-get install -y --no-install-recommends \
 
10
  bash bash-completion nano vim less \
 
11
  tmux screen htop procps \
 
12
  python3 python3-pip python3-venv python3-dev \
 
 
 
13
  curl wget git netcat-openbsd dnsutils iputils-ping \
 
14
  build-essential gcc g++ make \
 
15
  zip unzip tar gzip bzip2 xz-utils \
 
16
  jq bc sed gawk \
17
+ ca-certificates locales \
 
 
 
18
  && rm -rf /var/lib/apt/lists/*
19
 
20
  # ─── Locale ─────────────────────────────────────────────────────────────────
21
  RUN locale-gen en_US.UTF-8
22
  ENV LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
23
 
24
+ # ─── Node.js 20 LTS via NodeSource ──────────────────────────────────────────
25
+ # Key: do NOT pre-install nodejs/npm above β€” zero package conflict this way.
26
  RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
27
  && apt-get install -y nodejs \
28
+ && rm -rf /var/lib/apt/lists/* \
29
+ && node --version && npm --version
30
 
31
+ # ─── Python venv (pip works with no extra flags ever) ────────────────────────
 
32
  RUN python3 -m venv /opt/venv
33
  ENV PATH="/opt/venv/bin:$PATH"
 
34
  RUN pip install --upgrade pip setuptools wheel
35
 
36
+ # ─── Workspace & app dirs ────────────────────────────────────────────────────
37
  RUN mkdir -p /workspace /app && chmod 777 /workspace
 
38
  WORKDIR /app
39
 
40
+ # ─── Python deps (cached layer) ──────────────────────────────────────────────
41
  COPY requirements.txt .
42
  RUN pip install --no-cache-dir -r requirements.txt
43
 
44
+ # ─── App source ──────────────────────────────────────────────────────────────
45
  COPY . .
46
 
47
+ # ─── Nice shell defaults ──────────────────────────────────────────────────────
48
+ RUN printf '%s\n' \
49
+ 'export PS1="\[\e[38;5;40m\]\u\[\e[0m\]@\[\e[38;5;33m\]webterminal\[\e[0m\]:\[\e[38;5;33m\]\w\[\e[0m\]\$ "' \
50
+ 'alias ll="ls -lah --color=auto"' \
51
+ 'alias la="ls -A"' \
52
+ 'alias py="python3"' \
53
+ 'cd /workspace' \
54
+ >> /root/.bashrc
55
 
 
56
  EXPOSE 7860
57
+ CMD ["python", "app.py"]