Skip to content

Commit

Permalink
chore: add support for codespaces / devcontainers (#3632)
Browse files Browse the repository at this point in the history
Adding basic support for codespaces.
  • Loading branch information
npalm authored Nov 29, 2023
1 parent d71e631 commit 8bc61e9
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ARG VARIANT="18-bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}
17 changes: 17 additions & 0 deletions .devcontainer/bashrc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
open_workspace() {
local workspace_file=$WORKSPACE/.vscode/gh-runners.code-workspace

if ! [ -f "$workspace_file" ]; then
echo "🔴 Missing workspace file"
return 1
fi

echo "🟡 Opening workspace"
if code "$workspace_file"; then
echo "🟢 Workspace opened"
return 0
else
echo "🔴 Failed to open workspace"
return 1
fi
}
32 changes: 32 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "GitHub Runners AWS",
"build": { "dockerfile": "Dockerfile" },
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/terraform:1": {}
},

"containerEnv": {
"WORKSPACE": "${containerWorkspaceFolder}" // e.g. /workspaces/my-project
},

"customizations": {
"vscode": {
"extensions": [
"dbaeumer.vscode-eslint",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner",
"hashicorp.hcl",
"hashicorp.terraform",
"hashicorp.terraform",
"orta.vscode-jest",
"yzhang.markdown-all-in-one"
]
}
},
"postCreateCommand": {
"bash_command": "bash ${containerWorkspaceFolder}/.devcontainer/postCreateScript.sh",
"welcome": "sudo cp -v .devcontainer/welcome.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt || true && sudo cp -v .devcontainer/welcome.txt /workspaces/.codespaces/shared/first-run-notice.txt || true"
}
}
1 change: 1 addition & 0 deletions .devcontainer/postCreateScript.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
printf "source \$WORKSPACE/.devcontainer/bashrc.sh\n" >> ~/.bashrc
53 changes: 53 additions & 0 deletions .devcontainer/welcome.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
================================================================================
================================================================================
=====================================================++++**+++==================
=================================================+++++=********+================
=============================================+***+=--:-#********+===============
==========================================+***+=--:::::-+*#*****+===============
=======================================+*#%*=--:::::::::::-=====+===============
=====================================+#%%##%*-:::::::::::::::::+================
===========================++======*#%%#######=-::::::::::::::=+================
=======================++==---::-+#%%###########+-:::::::::::-+=================
====================+==-::::::-=#%%################+=::::::::+==================
=================++=-:::::::-=#%%%####%%##**########%#*++=-:++==================
===============+=-:::-------*%%%###%%%#=:...:-*############*+===================
=====. .-====-:--++***+++#%%###%#%%+: .-*###########+====================
===-. --:-++**+=====+%%%###%%#%*- :*#########*======================
=== .:==++=========*%%%#####%#%*=. .=#########*=======================
===: :: .==========+%%%%#####%%%%#+=-:::-+#########+========================
====: :=========#%%%%#####%#**#####*##########+==========================
==== .=========%%%%%####*+=*%##############=============================
====-.... :--------=##%%%%#*==*%##############=::++==========================
========--::---------=-=#%%%#+=#%#############*=-::-*===========================
======------------=+*=---*#++*%#############+-:::::++===========================
=====----------=+*+=+---=++*%%%%#########**+-:::::++============================
===----------+*+=-+*+-=+=*#+=*%%%%%%%#*+==+#=:::-*+=============================
==---------+**+-=**+===**=-=--=+***+======#+-::=+===============================
==----------+=-=**=:=+*=--++---==========**=:-++================================
=---------=*=-=**=::::--=*+----=-:::-===**=-=+==================================
=--------=*=-+**+::-=*+=*+-----=. ..=+==+====================================
=-------==--***+=+**=*+*=------. -+=..=====================================
=------=--=***+**+=-+*+------==. .=+: .=====================================
=--------=*****+---++=-----===== .=: :======================================
==------=***+=----==-----======- -=======================================
===----=*+=------=-----=========: .========================================
====--==------------==============--============================================
======--------==================================================================
================================================================================
================================================================================
================================================================================
================================================================================
==========================================================================-:-=++


Welcome to the AWS GitHub runners:

Load the vscode workspace to get started

Option 1: run `open_workspace`
Option 2: open the workspace file `.vscoe/gh-runners.code-workspace` and load the workspace

Build the lambda:
- cd lambdas
- yarn instal & yarn run dist

0 comments on commit 8bc61e9

Please sign in to comment.