-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a devcontainer with brew so I can work on ipad
- Loading branch information
1 parent
b0d3609
commit 3ea0aaf
Showing
4 changed files
with
155 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,19 @@ | ||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/ubuntu/.devcontainer/base.Dockerfile | ||
|
||
# [Choice] Ubuntu version (use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon): ubuntu-22.04, ubuntu-20.04, ubuntu-18.04 | ||
ARG VARIANT="jammy" | ||
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT} | ||
|
||
# [Optional] Uncomment this section to install additional OS packages. | ||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y install --no-install-recommends locales | ||
|
||
RUN locale-gen en_US.UTF-8 | ||
ENV LANG en_US.UTF-8 | ||
ENV LANGUAGE en_US:en | ||
ENV LC_ALL en_US.UTF-8 | ||
|
||
USER root | ||
|
||
ENTRYPOINT ["/bin/zsh"] | ||
CMD ["/bin/zsh"] |
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,62 @@ | ||
# README | ||
|
||
Demonstrate a simple `zsh` container using features. | ||
|
||
Demonstrates: | ||
|
||
* Using features | ||
* It seems to be much quicker to build. | ||
|
||
TODO: | ||
|
||
* Configure zsh correctly (niceprompt). | ||
|
||
## Contents | ||
|
||
- [README](#readme) | ||
- [Contents](#contents) | ||
- [Start (vscode)](#start-vscode) | ||
- [Run tests](#run-tests) | ||
- [Stop](#stop) | ||
- [Resources](#resources) | ||
|
||
## Start (vscode) | ||
|
||
Use the Remote Containers extension and select "Reopen in Container" or... | ||
|
||
```sh | ||
# start devcontainer | ||
./devcontainerctl.sh -n=07_oh_my_zsh | ||
|
||
# start devcontainer (rebuild) | ||
./devcontainerctl.sh -n=07_oh_my_zsh --no-cache | ||
``` | ||
|
||
Use `⌘ + ^ + p` and "Dev Containers: Attach to a running container" | ||
|
||
Add `/workspaces/devcontainer_examples` as a workspace to the new vscode editor. | ||
|
||
```sh | ||
cd /workspaces/devcontainer_examples | ||
``` | ||
|
||
## Run tests | ||
|
||
```sh | ||
cd ./07_oh_my_zsh | ||
echo $DEVCONTAINER_TYPE | ||
``` | ||
|
||
## Stop | ||
|
||
```sh | ||
# stop devcontainer | ||
./devcontainerctl.sh -n=07_oh_my_zsh --down | ||
``` | ||
|
||
## Resources | ||
|
||
* devcontainers/cli repo [here](https://github.com/devcontainers/cli) | ||
* devcontainers-contrib/features repo [here](https://github.com/devcontainers-contrib/features) | ||
* codespaces-multi-repository-monorepo-scenarios blog [here](https://github.blog/2022-04-20-codespaces-multi-repository-monorepo-scenarios/) | ||
* integrated-terminal config [here](https://code.visualstudio.com/docs/editor/integrated-terminal) |
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,66 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/ubuntu | ||
{ | ||
"name": "07_oh_my_zsh", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"context": ".", | ||
// Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04 | ||
// Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon. | ||
"args": { "VARIANT": "ubuntu-22.04" } | ||
}, | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "bash /workspaces/devcontainer_examples/.devcontainer/07_oh_my_zsh/postCreateCommand.sh", | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
|
||
"containerUser": "root", | ||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
"remoteUser": "root", | ||
"features": { | ||
"ghcr.io/devcontainers/features/common-utils:2": { | ||
"configureZshAsDefaultShell": true, | ||
"installZsh": true, | ||
"installOhMyZsh": true, | ||
"username": "root" | ||
}, | ||
"ghcr.io/devcontainers/features/git:1": { | ||
"version": "latest" | ||
}, | ||
"ghcr.io/meaningful-ooo/devcontainer-features/homebrew:2": { | ||
"version": "latest", | ||
"shallowClone": true | ||
} | ||
}, | ||
// Configure tool-specific properties. | ||
"customizations": { | ||
// Configure properties specific to VS Code. | ||
"vscode": { | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"ms-azuretools.vscode-docker", | ||
"oderwat.indent-rainbow", | ||
"timonwong.shellcheck", | ||
"DavidAnson.vscode-markdownlint" | ||
] | ||
}, | ||
"settings": { | ||
"terminal.integrated.profiles.linux": { | ||
"zsh": { | ||
"path": "/usr/bin/zsh" | ||
} | ||
}, | ||
"terminal.integrated.defaultProfile.linux": "zsh" | ||
} | ||
}, | ||
"containerEnv": { | ||
"MY_TEST_SECRET": "${localEnv:TEST_SECRET}", | ||
"MY_VARIABLE": "${localEnv:MY_VARIABLE}", | ||
"DEVCONTAINER_TYPE": "07_oh_my_zsh" | ||
}, | ||
// NOTE: THIS IS NOT WORKING | ||
// --mount-workspace-git-root false | ||
// ,"workspaceMount": "source=${localWorkspaceFolder}/01_bash_container,target=/workspace,type=bind,consistency=cached", | ||
// "workspaceFolder": "/workspace" | ||
} |
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,8 @@ | ||
#!/bin/bash/env bash | ||
echo "Executing postCreateCommand.sh" | ||
echo "uname: $(uname -a)" | ||
echo "whoami: $(whoami)" | ||
|
||
sed -i.bak "s/ZSH_THEME=\"codespaces\"/ZSH_THEME=\"robbyrussell\"/g" /root/.zshrc | ||
sed -i.bak "s/ZSH_THEME=\"codespaces\"/ZSH_THEME=\"robbyrussell\"/g" ~/.zshrc | ||
|