From 40f09ae5c560dcf02b9222fcc297fa28dabaaf54 Mon Sep 17 00:00:00 2001 From: Aaron Croissette Date: Tue, 23 Apr 2024 22:46:23 -0400 Subject: [PATCH] feat: docker-compose-deploy template, shell config for AWS and GCP --- .github/template/docker-compose-deploy | 1 + .gitmodules | 3 +++ .ssh/config | 17 +++++++++++++++++ Dockerfile | 4 ++++ config.sh | 14 +++++++++++--- 5 files changed, 36 insertions(+), 3 deletions(-) create mode 160000 .github/template/docker-compose-deploy create mode 100644 .ssh/config diff --git a/.github/template/docker-compose-deploy b/.github/template/docker-compose-deploy new file mode 160000 index 0000000..daf5b7c --- /dev/null +++ b/.github/template/docker-compose-deploy @@ -0,0 +1 @@ +Subproject commit daf5b7c314016caad8d1819627aed3f7b7aefcb8 diff --git a/.gitmodules b/.gitmodules index 409c94e..380c9c7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,3 +8,6 @@ [submodule ".github/template/terraform-prepare"] path = .github/template/terraform-prepare url = git@github.com:acrois/terraform-prepare +[submodule ".github/template/docker-compose-deploy"] + path = .github/template/docker-compose-deploy + url = git@github.com:acrois/docker-compose-deploy diff --git a/.ssh/config b/.ssh/config new file mode 100644 index 0000000..c671fed --- /dev/null +++ b/.ssh/config @@ -0,0 +1,17 @@ +Host gcp-* + ProxyCommand gcloud compute start-iap-tunnel $(cut -c 4- <<< "%h") %p --listen-on-stdin --verbosity=warning + StrictHostKeyChecking no + +Host aws-* + ProxyCommand aws ssm start-session --target $(cut -c 4- <<< "%h") --document-name AWS-StartSSHSession --parameters portNumber=%p + StrictHostKeyChecking no + +Host i-* mi-* + ProxyCommand aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters portNumber=%p + StrictHostKeyChecking no + +Host * * + ControlMaster auto + ControlPersist 900 + # Alternative: /tmp/%r@%h-%p + ControlPath /tmp/u-%i-ssh-%C diff --git a/Dockerfile b/Dockerfile index 1110b0f..3fdfc4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,7 @@ RUN \ tar \ coreutils \ python3 \ + openssh \ && apk add \ --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ \ git-filter-repo \ @@ -24,6 +25,9 @@ ENTRYPOINT [ "/entrypoint.sh" ] WORKDIR /etc/skel/ RUN echo -e "\nsource ~/scripts/config/.profile\n" >> .profile +WORKDIR /etc/skel/.ssh/ +COPY .ssh . + WORKDIR /etc/skel/scripts/ COPY config.sh . COPY config ./config diff --git a/config.sh b/config.sh index 3bb0ec9..50a2eda 100755 --- a/config.sh +++ b/config.sh @@ -1,3 +1,11 @@ -#/usr/bin/env sh -echo -e "\nsource $HOME/scripts/config/.profile\n" >> ~/.profile -source ~/.profile +#!/usr/bin/env sh + +DEST="$HOME/.profile" + +if [ -f "$HOME/.bash_profile" ]; then + DEST="$HOME/.bash_profile"; +fi + +# echo $DEST; +echo "\nsource $HOME/scripts/config/.profile\n" >> $DEST; +source $DEST;