diff --git a/.github/workflows/build-and-push.yml b/.gitea/workflows/build-and-push.yml similarity index 100% rename from .github/workflows/build-and-push.yml rename to .gitea/workflows/build-and-push.yml diff --git a/Dockerfile b/Dockerfile index 75b8f21..7d67453 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,8 @@ RUN apk add --no-cache ca-certificates COPY --from=builder /app/sshserver /usr/local/bin/sshserver +ENV COMMAND /app/tui + EXPOSE 22 CMD ["/usr/local/bin/sshserver"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index ca42381..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,11 +0,0 @@ -services: - ssh-server: - image: ssh-server - build: . - ports: - - "22:22" - volumes: - - ../tui:/app/tui:ro - cap_add: - - SYS_CHROOT - restart: unless-stopped diff --git a/main.go b/main.go index bc17c3d..4862a0d 100644 --- a/main.go +++ b/main.go @@ -81,7 +81,11 @@ func handleChannel(channel ssh.Channel, requests <-chan *ssh.Request) { req.Reply(true, nil) case "shell": req.Reply(true, nil) - cmd := exec.Command("/app/tui") + command := os.Getenv("COMMAND") + if command == "" { + command = "/app/tui" + } + cmd := exec.Command(command) cmd.Env = []string{"PATH=/bin"} cmd.Dir = "/" var err error