Skip to content

Commit 8bc61e9

Browse files
authored
chore: add support for codespaces / devcontainers (#3632)
Adding basic support for codespaces.
1 parent d71e631 commit 8bc61e9

File tree

5 files changed

+105
-0
lines changed

5 files changed

+105
-0
lines changed

.devcontainer/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ARG VARIANT="18-bullseye"
2+
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}

.devcontainer/bashrc.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
open_workspace() {
2+
local workspace_file=$WORKSPACE/.vscode/gh-runners.code-workspace
3+
4+
if ! [ -f "$workspace_file" ]; then
5+
echo "🔴 Missing workspace file"
6+
return 1
7+
fi
8+
9+
echo "🟡 Opening workspace"
10+
if code "$workspace_file"; then
11+
echo "🟢 Workspace opened"
12+
return 0
13+
else
14+
echo "🔴 Failed to open workspace"
15+
return 1
16+
fi
17+
}

.devcontainer/devcontainer.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "GitHub Runners AWS",
3+
"build": { "dockerfile": "Dockerfile" },
4+
"features": {
5+
"ghcr.io/devcontainers/features/github-cli:1": {},
6+
"ghcr.io/devcontainers/features/terraform:1": {}
7+
},
8+
9+
"containerEnv": {
10+
"WORKSPACE": "${containerWorkspaceFolder}" // e.g. /workspaces/my-project
11+
},
12+
13+
"customizations": {
14+
"vscode": {
15+
"extensions": [
16+
"dbaeumer.vscode-eslint",
17+
"editorconfig.editorconfig",
18+
"esbenp.prettier-vscode",
19+
"firsttris.vscode-jest-runner",
20+
"hashicorp.hcl",
21+
"hashicorp.terraform",
22+
"hashicorp.terraform",
23+
"orta.vscode-jest",
24+
"yzhang.markdown-all-in-one"
25+
]
26+
}
27+
},
28+
"postCreateCommand": {
29+
"bash_command": "bash ${containerWorkspaceFolder}/.devcontainer/postCreateScript.sh",
30+
"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"
31+
}
32+
}

.devcontainer/postCreateScript.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
printf "source \$WORKSPACE/.devcontainer/bashrc.sh\n" >> ~/.bashrc

.devcontainer/welcome.txt

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
================================================================================
2+
================================================================================
3+
=====================================================++++**+++==================
4+
=================================================+++++=********+================
5+
=============================================+***+=--:-#********+===============
6+
==========================================+***+=--:::::-+*#*****+===============
7+
=======================================+*#%*=--:::::::::::-=====+===============
8+
=====================================+#%%##%*-:::::::::::::::::+================
9+
===========================++======*#%%#######=-::::::::::::::=+================
10+
=======================++==---::-+#%%###########+-:::::::::::-+=================
11+
====================+==-::::::-=#%%################+=::::::::+==================
12+
=================++=-:::::::-=#%%%####%%##**########%#*++=-:++==================
13+
===============+=-:::-------*%%%###%%%#=:...:-*############*+===================
14+
=====. .-====-:--++***+++#%%###%#%%+: .-*###########+====================
15+
===-. --:-++**+=====+%%%###%%#%*- :*#########*======================
16+
=== .:==++=========*%%%#####%#%*=. .=#########*=======================
17+
===: :: .==========+%%%%#####%%%%#+=-:::-+#########+========================
18+
====: :=========#%%%%#####%#**#####*##########+==========================
19+
==== .=========%%%%%####*+=*%##############=============================
20+
====-.... :--------=##%%%%#*==*%##############=::++==========================
21+
========--::---------=-=#%%%#+=#%#############*=-::-*===========================
22+
======------------=+*=---*#++*%#############+-:::::++===========================
23+
=====----------=+*+=+---=++*%%%%#########**+-:::::++============================
24+
===----------+*+=-+*+-=+=*#+=*%%%%%%%#*+==+#=:::-*+=============================
25+
==---------+**+-=**+===**=-=--=+***+======#+-::=+===============================
26+
==----------+=-=**=:=+*=--++---==========**=:-++================================
27+
=---------=*=-=**=::::--=*+----=-:::-===**=-=+==================================
28+
=--------=*=-+**+::-=*+=*+-----=. ..=+==+====================================
29+
=-------==--***+=+**=*+*=------. -+=..=====================================
30+
=------=--=***+**+=-+*+------==. .=+: .=====================================
31+
=--------=*****+---++=-----===== .=: :======================================
32+
==------=***+=----==-----======- -=======================================
33+
===----=*+=------=-----=========: .========================================
34+
====--==------------==============--============================================
35+
======--------==================================================================
36+
================================================================================
37+
================================================================================
38+
================================================================================
39+
================================================================================
40+
==========================================================================-:-=++
41+
42+
43+
Welcome to the AWS GitHub runners:
44+
45+
Load the vscode workspace to get started
46+
47+
Option 1: run `open_workspace`
48+
Option 2: open the workspace file `.vscoe/gh-runners.code-workspace` and load the workspace
49+
50+
Build the lambda:
51+
- cd lambdas
52+
- yarn instal & yarn run dist
53+

0 commit comments

Comments
 (0)