-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(devcontainer): enable dev environments in GH Codespaces and VS C…
…ode remote containers (#135) * feat(devcontainer): enable dev environments in GH Codespaces and VS Code remote containers * fix(devcontainer): remove device declaration that is incompatible with GH codespaces * fix(devcontainer): declare forwarded ports for GH Codespaces * fix(devcontainer): set up port attributes * fix(devcontainer): use integer port numbers * fix(devcontainer): ensure ports are only declared once * fix(devcontainer): ensure the node_modules are owned by node at create * clone a sample repo with icons * clone sample repos to home folder * clone to home/node Co-authored-by: MrRobz <robinphilipthomas@outlook.in>
- Loading branch information
1 parent
23cd19c
commit 72be610
Showing
4 changed files
with
97 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,26 @@ | ||
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster | ||
ARG VARIANT=16-bullseye | ||
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT} | ||
|
||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y upgrade \ | ||
&& apt-get -y install --no-install-recommends git nano openssl libnss3-dev chromium zsh \ | ||
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /root/.gnupg /tmp/library-scripts | ||
|
||
RUN chsh -s $(which zsh) root \ | ||
&& chsh -s $(which zsh) node | ||
|
||
# Clone a sample repos with svg icons in it | ||
RUN cd /home/node && git clone https://github.com/Remix-Design/RemixIcon.git | ||
RUN cd /home/node && git clone https://github.com/tailwindlabs/heroicons.git | ||
|
||
EXPOSE 3000 | ||
EXPOSE 5901 | ||
EXPOSE 6080 | ||
|
||
# [Optional] Uncomment if you want to install an additional version of node using nvm | ||
# ARG EXTRA_NODE_VERSION=10 | ||
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}" | ||
|
||
# [Optional] Uncomment if you want to install more global node modules | ||
# RUN su node -c "npm install -g <your-package-list-here>" |
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,37 @@ | ||
{ | ||
"name": "iconshelf", | ||
"dockerComposeFile": "docker-compose.yml", | ||
"service": "iconshelf", | ||
"workspaceFolder": "/workspace", | ||
"postCreateCommand": "mkdir -p node_modules && sudo chown -R node:node node_modules && npm ci", | ||
"remoteUser": "node", | ||
"settings": {}, | ||
"extensions": [ | ||
"bradlc.vscode-tailwindcss", | ||
"dbaeumer.vscode-eslint", | ||
"EditorConfig.EditorConfig", | ||
"esbenp.prettier-vscode" | ||
], | ||
"forwardPorts": [3000, 5901, 6080], | ||
"portsAttributes": { | ||
"3000": { | ||
"label": "Dev Server", | ||
"onAutoForward": "notify" | ||
}, | ||
"5091": { | ||
"label": "NoVNC Internal", | ||
"onAutoForward": "silent" | ||
}, | ||
"6080": { | ||
"label": "NoVNC Web", | ||
"onAutoForward": "openBrowserOnce" | ||
} | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/desktop-lite:1": { | ||
"version": "latest", | ||
"webPort": 6080, | ||
"vncPort": 5901 | ||
} | ||
} | ||
} |
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 @@ | ||
version: "2.1" | ||
|
||
services: | ||
iconshelf: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
args: | ||
VARIANT: 16-bullseye | ||
|
||
security_opt: | ||
- seccomp:unconfined | ||
|
||
environment: | ||
- PUID=1000 | ||
- PGID=1000 | ||
|
||
working_dir: /workspace | ||
|
||
volumes: | ||
- ..:/workspace:cached | ||
- iconshelf_node_modules:/workspace/node_modules | ||
|
||
shm_size: "1gb" # provide min required memory for electron not to crash | ||
|
||
# Overrides default command so things don't shut down after the process ends. | ||
command: /bin/sh -c "while sleep 1000; do :; done" | ||
|
||
user: node | ||
|
||
volumes: | ||
iconshelf_node_modules: |
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