# Use an intermediate image for setting up the environment and permissions
FROM alpine:latest as builder

# Add the binary directly from the URL
ADD https://git.nixc.us/colin/ssh-timeout/src/branch/main/dist/ssh-timeout_linux_amd64_static /ssh-timeout

# Set execute permissions on the binary
RUN chmod +x /ssh-timeout

# Start from a scratch image for the final output
FROM scratch

# Copy the prepared binary from the builder stage
COPY --from=builder /ssh-timeout /ssh-timeout

# Optionally define default environment variables
ENV SSH_BACKEND="default-backend:22"
ENV SSH_MAX_DURATION="3600"
ENV LISTEN_ADDR=":2222"

# Command to run the binary
CMD ["/ssh-timeout"]

