Greg-House commited on
Commit
f8ac40b
·
verified ·
1 Parent(s): ac1b1bf

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +53 -0
Dockerfile ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # --- Stage 1: Build remotemoe ---
2
+ FROM golang:1.21-alpine AS builder
3
+
4
+ RUN apk add --no-cache git
5
+ WORKDIR /app
6
+
7
+ # Copy dependency files and source
8
+ COPY go.mod go.sum ./
9
+ RUN go mod download
10
+ COPY . .
11
+
12
+ # Build statically
13
+ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o remotemoe main.go
14
+
15
+ # --- Stage 2: Runtime ---
16
+ FROM alpine:latest
17
+
18
+ # Install sslh (multiplexer) and supervisor (process manager)
19
+ RUN apk add --no-cache sslh supervisor ca-certificates
20
+
21
+ WORKDIR /root/
22
+
23
+ # Copy binary from builder
24
+ COPY --from=builder /app/remotemoe .
25
+
26
+ # Create directories
27
+ RUN mkdir -p /etc/remotemoe /var/log/supervisor
28
+
29
+ # 1. Configure Supervisor
30
+ # This runs both remotemoe and sslh at the same time
31
+ RUN echo "[supervisord]" > /etc/supervisord.conf && \
32
+ echo "nodaemon=true" >> /etc/supervisord.conf && \
33
+ echo "" >> /etc/supervisord.conf && \
34
+ echo "[program:remotemoe]" >> /etc/supervisord.conf && \
35
+ echo "command=/root/remotemoe --ssh-addr :2222 --http-addr :8080" >> /etc/supervisord.conf && \
36
+ echo "stdout_logfile=/dev/stdout" >> /etc/supervisord.conf && \
37
+ echo "stdout_logfile_maxbytes=0" >> /etc/supervisord.conf && \
38
+ echo "stderr_logfile=/dev/stderr" >> /etc/supervisord.conf && \
39
+ echo "stderr_logfile_maxbytes=0" >> /etc/supervisord.conf && \
40
+ echo "" >> /etc/supervisord.conf && \
41
+ echo "[program:sslh]" >> /etc/supervisord.conf && \
42
+ echo "# Listen on 7860, forward SSH to 2222, HTTP to 8080" >> /etc/supervisord.conf && \
43
+ echo "command=sslh -f -u root -p 0.0.0.0:7860 --ssh 127.0.0.1:2222 --http 127.0.0.1:8080" >> /etc/supervisord.conf && \
44
+ echo "stdout_logfile=/dev/stdout" >> /etc/supervisord.conf && \
45
+ echo "stdout_logfile_maxbytes=0" >> /etc/supervisord.conf && \
46
+ echo "stderr_logfile=/dev/stderr" >> /etc/supervisord.conf && \
47
+ echo "stderr_logfile_maxbytes=0" >> /etc/supervisord.conf
48
+
49
+ # Expose the HF App Port
50
+ EXPOSE 7860
51
+
52
+ # Start Supervisor (which starts the other two)
53
+ CMD ["supervisord", "-c", "/etc/supervisord.conf"]