gitpod: run npm install on init

This commit is contained in:
Abel Luck 2023-06-06 07:10:49 +00:00
parent fd7e543d16
commit 9c7a385c77

View file

@ -2,31 +2,11 @@
# build the docker image for our gitpod from this dockerfile # build the docker image for our gitpod from this dockerfile
image: image:
file: .gitpod.dockerfile file: .gitpod.dockerfile
# where gitpod should place our workspace (relative to /workspace)
workspaceLocation: "."
# all init+before are run in prebuilds, and on workspace startup # all init+before are run in prebuilds, and on workspace startup
tasks: tasks:
- name: tailscaled - name: npm install
command: | init: |
if [ -n "$TAILSCALE_AUTHKEY" ]; then npm install
if [ -n "${TAILSCALE_STATE_MYPROJECT}" ]; then
# restore the tailscale state from gitpod user's env vars
sudo mkdir -p /var/lib/tailscale
echo "${TAILSCALE_STATE_MYPROJECT}" | sudo tee /var/lib/tailscale/tailscaled.state > /dev/null
fi
sudo tailscaled
fi
- name: tailscale
command: |
if [ -n "$TAILSCALE_AUTHKEY" ]; then
if [ -n "${TAILSCALE_STATE_MYPROJECT}" ]; then
sudo -E tailscale up --authkey=${TAILSCALE_AUTHKEY}
else
sudo -E tailscale up --authkey=${TAILSCALE_AUTHKEY} --hostname "gitpod-${GITPOD_GIT_USER_NAME// /-}-$(echo ${GITPOD_WORKSPACE_CONTEXT} | jq -r .repository.name)"
# store the tailscale state into gitpod user
gp env TAILSCALE_STATE_MYPROJECT="$(sudo cat /var/lib/tailscale/tailscaled.state)"
fi
fi
# extra extensions we share # extra extensions we share
vscode: vscode:
extensions: extensions: