Skip to content

Commit

Permalink
WIP Setup devcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
wei committed Dec 14, 2024
1 parent 175f6bb commit 373187c
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ARG VARIANT="22-bookworm"

FROM mcr.microsoft.com/devcontainers/typescript-node:1-${VARIANT}
28 changes: 28 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "Socialify Dev Environment",

"build": {
"dockerfile": "Dockerfile"
},

"features": {
"ghcr.io/devcontainers/features/github-cli:1": {
"installDirectlyFromGitHubRelease": true,
"version": "latest"
}
},

"forwardPorts": [3000],

"containerEnv": {
"NEXT_TELEMETRY_DISABLED": "1",
"PNPM_HOME": "/home/node/.local/share/pnpm",
"PNPM_STORE_DIR": "/home/node/.local/share/.pnpm-store"
},

"postCreateCommand": "corepack install",

"postStartCommand": ".devcontainer/post-start.sh",

"customizations": {}
}
18 changes: 18 additions & 0 deletions .devcontainer/post-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

if [ ! -f /home/node/.first_run ]; then
git config --global --add safe.directory $(pwd)
git config --global core.autocrlf true
git config --global core.editor nano

pnpm config set store-dir $PNPM_STORE_DIR
pnpm install
pnpm playwright:install

if [ ! -f .env ]; then
cp .env.example .env
echo "Please fill in the .env file"
fi

touch /home/node/.first_run
fi
2 changes: 1 addition & 1 deletion .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
# gitmoji as a commit hook
exec < /dev/tty
npx gitmoji-cli --hook $1 $2
pnpx dlx gitmoji-cli --hook $1 $2
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pnpm lint
pnpm test:unit

# Install Playwright dependencies (first-time)
# pnpm playwright install --with-deps chrome
# pnpm playwright:install

# Run e2e tests
pnpm test:e2e
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"ncu": "npx npm-check-updates -u",
"verify": "pnpm lint && pnpm test && pnpm build",
"download-font": "./fonts/download-font.sh",
"playwright:install": "pnpm playwright install --with-deps chrome",
"postinstall": "mkdir -p ./public && cp ./node_modules/yoga-wasm-web/dist/yoga.wasm ./public/yoga.wasm && cp ./node_modules/@resvg/resvg-wasm/index_bg.wasm ./public/resvg_bg.wasm",
"prepare": "is-ci || husky"
},
Expand Down

0 comments on commit 373187c

Please sign in to comment.