| 62 | |
| 63 | == GCP Cloud Run == |
| 64 | |
| 65 | - [https://www.varstack.com/2022/06/04/Cloud-Run-SSH/ Cloud Run SSH - computation power & on-demand] |
| 66 | Full working example |
| 67 | You can use this Dockerfile to generate a Cloud Run service to which you can SSH: |
| 68 | {{{ |
| 69 | FROM alpine:latest |
| 70 | |
| 71 | RUN apk update && apk add websocat openssh && \ |
| 72 | ( echo 'root:root' | chpasswd ) && \ |
| 73 | sed -i 's|#PermitRootLogin|PermitRootLogin yes\n\0|g' \ |
| 74 | /etc/ssh/sshd_config && \ |
| 75 | cat /etc/ssh/sshd_config |
| 76 | |
| 77 | CMD ( cd /etc/ssh && ssh-keygen -A ) && \ |
| 78 | /usr/sbin/sshd -f /etc/ssh/sshd_config && \ |
| 79 | websocat --binary ws-l:0.0.0.0:8080 tcp:127.0.0.1:22 |
| 80 | }}} |
| 81 | This Dockerfile uses a barebones alpine image, but you could use a beefy image with a lot of tools that you might need in your temporary computation machine. It installs websocat and openssh, enables root SSH login and sets the root password to root. |
| 82 | |
| 83 | Put this Dockerfile in an empty directory and deploy this using: |
| 84 | {{{ |
| 85 | $ gcloud alpha run deploy alpine-ssh --platform managed \ |
| 86 | --execution-environment gen2 --source . |
| 87 | }}} |
| 88 | You can SSH to the resulting image using: |
| 89 | {{{ |
| 90 | $ ssh -o ProxyCommand='websocat --binary wss://alpine-ssh-AAAAAAAAAA.a.run.app' root@host |
| 91 | }}} |
| 92 | (use root when prompted for password). SUCCESS! |