-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.gateway
More file actions
44 lines (35 loc) · 1.77 KB
/
Copy pathDockerfile.gateway
File metadata and controls
44 lines (35 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
FROM node:24-slim AS ttyd-html
# Build custom ttyd frontend with banner + logout button
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
ARG TTYD_HOST=claude.frustrated.blog
ARG BUILD_VERSION=dev
ARG TUNNEL_NAME=claude-code-server
COPY ttyd/ /tmp/ttyd/
RUN chmod +x /tmp/ttyd/patch-index.sh && \
TTYD_HOST=${TTYD_HOST} BUILD_VERSION=${BUILD_VERSION} TUNNEL_NAME=${TUNNEL_NAME} /tmp/ttyd/patch-index.sh
FROM node:24-slim
# The gateway is deliberately lean: it never runs a user's actual dev
# environment (that's the worker image, one container per user). It just
# terminates ttyd connections, reads the Authelia-authenticated username,
# and dispatches to (creating if needed) that user's own worker container
# over the host's docker.sock.
RUN apt-get update && apt-get install -y \
curl \
docker.io \
&& rm -rf /var/lib/apt/lists/*
# Install ttyd from GitHub releases
RUN curl -L https://github.com/tsl0922/ttyd/releases/latest/download/ttyd.x86_64 -o /usr/local/bin/ttyd && \
chmod +x /usr/local/bin/ttyd
# Copy custom ttyd frontend from build stage
COPY --from=ttyd-html /usr/local/share/ttyd/index.html /usr/local/share/ttyd/index.html
# Dispatch scripts: ttyd-dispatch is what ttyd spawns per connection;
# dispatch-to-worker does the actual get-or-create-worker + docker exec, and
# is written to be reusable by a future SSH dispatch path too.
COPY scripts/ttyd-dispatch /usr/local/bin/ttyd-dispatch
COPY scripts/dispatch-to-worker /usr/local/bin/dispatch-to-worker
COPY scripts/reap-idle-users /usr/local/bin/reap-idle-users
RUN chmod +x /usr/local/bin/ttyd-dispatch /usr/local/bin/dispatch-to-worker /usr/local/bin/reap-idle-users
COPY entrypoint-gateway.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 7681
ENTRYPOINT ["/entrypoint.sh"]