Skip to content

Instantly share code, notes, and snippets.

@SIMULATAN
Created October 1, 2024 12:35
Show Gist options
  • Save SIMULATAN/79f740de8a6da9e6a3170c98c39850d5 to your computer and use it in GitHub Desktop.
Save SIMULATAN/79f740de8a6da9e6a3170c98c39850d5 to your computer and use it in GitHub Desktop.
Leocloud Docker (Safe)
FROM debian:testing-slim
RUN apt update && apt install -y firefox-esr curl
ARG user=hackmenot
ARG group=hackmenot
ARG uid=1001
ARG gid=1001
RUN groupadd -g ${gid} ${group}
RUN useradd -u ${uid} -g ${group} -s /bin/sh -m ${user}
USER ${uid}:${gid}
WORKDIR /cloud
COPY --chmod=777 <<-"EOF" /entrypoint.sh
#!/usr/bin/env bash
echo "Downloading..."
curl -fsSLO https://admission.cloud.htl-leonding.ac.at/html/leocloud-cli.tgz
echo "Downloading done, extracting..."
tar -xzf leocloud-cli.tgz
echo "Extracting done, setting up environment..."
export DISPLAY=":0"
export BROWSER=firefox
chmod +x ./leocloud/linux/leocloud
echo "Executing on $DISPLAY..."
./leocloud/linux/leocloud auth login
echo "Generated Kubeconfig:"
cat ~/.kube/config
EOF
ENTRYPOINT [ "/entrypoint.sh" ]
@SIMULATAN
Copy link
Author

SIMULATAN commented Oct 1, 2024

Instructions:

docker build . -t leocloud-login
# n = unix socket location (may not work with XWayland) - should be equivalent to `$DISPLAY`
# find host path using `find /tmp/.X11-unix/ -name 'X*'`
docker run -it --rm -v /tmp/.X11-unix/X<n>:/tmp/.X11-unix/X0 leocloud-login

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment