Skip to content

Commit

Permalink
fixing environment
Browse files Browse the repository at this point in the history
  • Loading branch information
MattReimer committed Jan 12, 2024
1 parent 3896a18 commit db2a47b
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 104 deletions.
12 changes: 9 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@ 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 6Gb so that Gatsby has a chance
ENV NODE_OPTIONS=--max-old-space-size=6144
# set memory to 8Gb so that Gatsby has a chance
ENV NODE_OPTIONS=--max-old-space-size=8192
ENV GATSBY_CPU_COUNT=2

21 changes: 19 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
{
"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": "gatsby build; gatsby serve -H 0.0.0.0 -p 8000",
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh"
},
"extensions": [
"GitHub.copilot",
"GitHub.copilot-chat",
Expand All @@ -14,7 +23,15 @@
]
}
},
"postCreateCommand": [
"yarn install"
// 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
]
}
41 changes: 17 additions & 24 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Gatsby Publish

name: Gatsby GHPages Publish
# NOTE: This is designed to work for a site living in the /docs folder. You'll need to make changes if it is not.
on:
push:
branches:
Expand Down Expand Up @@ -28,26 +28,16 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/package.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
exit 0
else
echo "Unable to determine package manager"
exit 1
fi

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: "18"
cache: ${{ steps.detect-package-manager.outputs.manager }}
node-version-file: ./.nvmrc
cache-dependency-path: ./package.json
cache: yarn

- name: Get correct version of Yarn
run: corepack enable; yarn set version berry

- name: Setup Pages
id: pages
Expand All @@ -58,23 +48,26 @@ jobs:
# You may remove this line if you want to manage the configuration yourself.
static_site_generator: gatsby


- name: Restore cache
uses: actions/cache@v3
with:
path: |
public
.cache
./public
./.cache
key: ${{ runner.os }}-gatsby-build-${{ hashFiles('public') }}
restore-keys: |
${{ runner.os }}-gatsby-build-
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
working-directory: .
run: yarn install

- name: Build with Gatsby
working-directory: .
env:
PREFIX_PATHS: 'true'
run: ${{ steps.detect-package-manager.outputs.manager }} run build
run: yarn run build

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
Expand Down
75 changes: 0 additions & 75 deletions .github/workflows/validate.yml

This file was deleted.

0 comments on commit db2a47b

Please sign in to comment.