This repository has been archived by the owner on Oct 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Bill Maxwell <[email protected]>
- Loading branch information
1 parent
3687440
commit 0c80591
Showing
3 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
args: { | ||
password: "" | ||
|
||
// Check out a git repo on startup. | ||
gitRepo: "" | ||
} | ||
containers: "code-server": { | ||
build: context: "." | ||
ports: publish: "8443/http" | ||
env: { | ||
PASSWORD: "secret://code-server-password/token" | ||
} | ||
dirs: { | ||
"/config": "volume://src-volume" | ||
} | ||
sidecars: { | ||
"install-extensions": { | ||
init: true | ||
build: context: "." | ||
dirs: { | ||
"/config": "volume://src-volume" | ||
} | ||
files: { | ||
"/acorn/bootstrap.sh": "\(localData.extensions.bootstrap)" | ||
} | ||
command: [ | ||
"sh", | ||
"-c", | ||
"/acorn/bootstrap.sh", | ||
] | ||
} | ||
if args.gitRepo != "" { | ||
"git-checkout": { | ||
init: true | ||
image: "alpine/git:v2.36.3" | ||
dirs: { | ||
"/config": "volume://src-volume" | ||
} | ||
files: { | ||
"/acorn/init.sh": "\(localData.git.initScript)" | ||
} | ||
entrypoint: "/bin/sh /acorn/init.sh" | ||
} | ||
} | ||
} | ||
} | ||
|
||
secrets: "code-server-password": { | ||
type: "token" | ||
data: { | ||
token: args.password | ||
} | ||
} | ||
|
||
volumes: "src-volume": {} | ||
|
||
localData: { | ||
code: { | ||
uid: 911 | ||
gid: 911 | ||
} | ||
git: { | ||
sshCommand: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" | ||
user: "root" | ||
initScript: """ | ||
#!/bin/sh | ||
set -x | ||
set -e | ||
ssh_dir="/\(localData.git.user)/.ssh/" | ||
export GIT_SSH_COMMAND="\(localData.git.sshCommand)" | ||
|
||
/bin/mkdir -p ${ssh_dir} | ||
/bin/chmod 700 ${ssh_dir} | ||
# sometimes the keys arent mounted | ||
sleep 3 | ||
files=$(ls /acorn/ssh|wc -l) | ||
if [ "${files}" -gt "0" ]; then | ||
cp /acorn/ssh/* ${ssh_dir} | ||
chmod 600 ${ssh_dir}/* | ||
fi | ||
|
||
if [ -d "/config/workspace/src_repo" ]; then | ||
exit 0 | ||
fi | ||
git clone \(args.gitRepo) /config/workspace/src_repo && chown -R \(localData.code.uid):\(localData.code.gid) /config/workspace/src_repo | ||
""" | ||
} | ||
extensions: { | ||
bootstrap: """ | ||
#!/bin/sh | ||
set -x | ||
set -e | ||
curl -L https://github.com/acorn-io/vscode-acorn/releases/download/v0.2.1/acorn-0.2.1.vsix > /tmp/acorn.vsix | ||
install-extension /tmp/acorn.vsix | ||
""" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM linuxserver/code-server | ||
|
||
RUN curl -sfL https://get.acorn.io | sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Code Server | ||
|
||
--- | ||
This is an Acorn with code-server, Acorn CLI, and Acorn VSCode extension preinstalled. | ||
|
||
## Quickstart | ||
|
||
To quickly deploy a code-server environment run the Acorn: | ||
|
||
```bash | ||
acorn run ghcr.io/acorn-io/library/code-server | ||
``` | ||
|
||
A password will be automatically generated for you, to obtain it, run: | ||
|
||
```bash | ||
acorn secrets | ||
# ... | ||
#code-server-password-XXXXX | ||
``` | ||
|
||
Look for the secret named code-server-password-[5 letter string] then run: | ||
|
||
```bash | ||
acorn secret reveal code-server-password-[5 letter string] | ||
``` | ||
|
||
Copy the Value and open the URL to the running instance. Paste the password when prompted and start using code-server environment. | ||
|
||
## Advanced Usage | ||
|
||
You can check out a public source repository over http(s) on launch by passing in `--git-repo`. |