Skip to content

Commit

Permalink
chore: extract postCreate into a script
Browse files Browse the repository at this point in the history
So that the Codespaces workaround will only be applied on Codespaces.

And also reorganize devcontainer.json.
  • Loading branch information
felipecrs committed Jul 17, 2023
1 parent 49b035a commit a003b62
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
23 changes: 9 additions & 14 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json",
"hostRequirements": {
"cpus": 4,
"memory": "7gb",
"storage": "32gb"
},
"name": "Renovate",
"dockerFile": "Dockerfile",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {}
},
"capAdd": ["SYS_PTRACE"],
"privileged": true,
"securityOpt": ["seccomp=unconfined"],
"hostRequirements": {
"cpus": 4,
"memory": "7gb",
"storage": "32gb"
},
"customizations": {
"vscode": {
"extensions": [
Expand All @@ -21,15 +24,7 @@
]
}
},
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined",
"--privileged"
],
// The chmod command fixes the permissions of /tmp, which for some reason is
// broken on GitHub Codespaces
"postCreateCommand": "set -ex; sudo chmod 1777 /tmp; yarn install",
"postCreateCommand": [".devcontainer/post-create.sh"],
// Otherwise jest watcher fails because deps were not installed yet
"waitFor": "postCreateCommand"
}
12 changes: 12 additions & 0 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -e

if [[ "${CODESPACES}" == true ]]; then
echo "Fixing permissions of /tmp for GitHub Codespaces..." >&2
sudo chmod 1777 /tmp
fi

set -x

exec yarn install

0 comments on commit a003b62

Please sign in to comment.