Greg-House commited on
Commit
43c8e9e
·
verified ·
1 Parent(s): fcd7f14

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -8
Dockerfile CHANGED
@@ -6,12 +6,13 @@ RUN apk add --no-cache git
6
 
7
  WORKDIR /app
8
 
9
- # Copy dependency files and download
10
- COPY go.mod go.sum ./
 
 
 
11
  RUN go mod download
12
 
13
- # Copy source and build
14
- COPY . .
15
  # Build statically
16
  RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o remotemoe main.go
17
 
@@ -21,15 +22,15 @@ FROM alpine:latest
21
  # Install sslh (multiplexer) and ca-certificates
22
  RUN apk add --no-cache sslh ca-certificates
23
 
24
- # Create a non-root user with ID 1000
25
  RUN adduser -D -u 1000 appuser
26
 
27
  WORKDIR /home/appuser
28
 
29
- # Copy the binary
30
  COPY --from=builder /app/remotemoe .
31
 
32
- # Create a start script
33
  RUN echo "#!/bin/sh" > start.sh && \
34
  echo "echo 'Starting remotemoe...'" >> start.sh && \
35
  echo "./remotemoe --ssh-addr :2222 --http-addr :8080 &" >> start.sh && \
@@ -39,7 +40,7 @@ RUN echo "#!/bin/sh" > start.sh && \
39
  echo "exec sslh -f -v -p 0.0.0.0:7860 --ssh 127.0.0.1:2222 --http 127.0.0.1:8080" >> start.sh && \
40
  chmod +x start.sh
41
 
42
- # Fix permissions so the non-root user can write SSH keys and logs
43
  RUN chown -R appuser:appuser /home/appuser
44
 
45
  # Switch to non-root user
 
6
 
7
  WORKDIR /app
8
 
9
+ # CLONE THE REPO DIRECTLY
10
+ # We clone the specific repo so we don't need files in the Space
11
+ RUN git clone https://github.com/fasmide/remotemoe.git .
12
+
13
+ # Download dependencies
14
  RUN go mod download
15
 
 
 
16
  # Build statically
17
  RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o remotemoe main.go
18
 
 
22
  # Install sslh (multiplexer) and ca-certificates
23
  RUN apk add --no-cache sslh ca-certificates
24
 
25
+ # Create a non-root user with ID 1000 (Required for security)
26
  RUN adduser -D -u 1000 appuser
27
 
28
  WORKDIR /home/appuser
29
 
30
+ # Copy the binary from the builder stage
31
  COPY --from=builder /app/remotemoe .
32
 
33
+ # Create a start script to handle the port multiplexing
34
  RUN echo "#!/bin/sh" > start.sh && \
35
  echo "echo 'Starting remotemoe...'" >> start.sh && \
36
  echo "./remotemoe --ssh-addr :2222 --http-addr :8080 &" >> start.sh && \
 
40
  echo "exec sslh -f -v -p 0.0.0.0:7860 --ssh 127.0.0.1:2222 --http 127.0.0.1:8080" >> start.sh && \
41
  chmod +x start.sh
42
 
43
+ # Fix permissions so the non-root user can write SSH keys
44
  RUN chown -R appuser:appuser /home/appuser
45
 
46
  # Switch to non-root user