Skip to content

Commit

Permalink
adding dev container
Browse files Browse the repository at this point in the history
  • Loading branch information
MattReimer committed Jan 12, 2024
1 parent a0e0c49 commit 97678ac
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Dockerfile
FROM mcr.microsoft.com/devcontainers/typescript-node:0-18

# Install wget if not already installed
RUN apt-get update && apt-get install -y wget

# Install Gatsby CLI and Yarn
RUN npm install -g gatsby-cli yarn
# Let's get the latest version of Yarn
RUN corepack enable
RUN yarn set version berry

# Download .zshrc from remote address
# RUN sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
USER node
RUN wget https://raw.githubusercontent.com/Riverscapes/environment/master/nar-ys.zsh-theme -O ~/.oh-my-zsh/custom/themes/nar-ys.zsh-theme
RUN wget https://raw.githubusercontent.com/Riverscapes/environment/master/.aliases -O ~/.aliases
RUN wget https://raw.githubusercontent.com/Riverscapes/environment/master/.zshrc -O ~/.zshrc

# set memory to 8Gb so that Gatsby has a chance
ENV NODE_OPTIONS=--max-old-space-size=8192
ENV GATSBY_CPU_COUNT=2

36 changes: 36 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"dockerFile": "Dockerfile",
"name": "Gatsby Docs Dev Container",
"waitFor": "onCreateCommand",
// On container creation, install dependencies.
"postCreateCommand": "yarn install",
// Build and run the dev site on container start.
"postAttachCommand": "cd docs; yarn build; yarn serve",
"customizations": {
"vscode": {
"extensions": [
"GitHub.copilot",
"GitHub.copilot-chat",
"eriklynd.json-tools",
"yzhang.markdown-all-in-one",
"unifiedjs.vscode-mdx",
"dbaeumer.vscode-eslint",
"christian-kohler.npm-intellisense",
"mhutchie.git-graph",
"GraphQL.vscode-graphql",
"GraphQL.vscode-graphql-syntax"
]
}
},
// Trigger actions on ports. More info: https://containers.dev/implementors/json_reference/#port-attributes
"portsAttributes": {
"8000": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
8000
]
}

0 comments on commit 97678ac

Please sign in to comment.