-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevcontainer_post_create.sh
More file actions
55 lines (44 loc) · 1.64 KB
/
devcontainer_post_create.sh
File metadata and controls
55 lines (44 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
function devcontainer_post_create() {
# Install GitHub CLI Copilot Extension
if [[ -n "$GH_TOKEN" ]] || [[ -n "$GITHUB_TOKEN" ]] ; then
gh extension install github/gh-copilot
fi
# set global ServerName so that apachectl isn't chatty
if [[ -n "$CODESPACE_NAME" ]]; then
SERVER_NAME="$CODESPACE_NAME-8080.app.github.dev"
HTTP_ADDRESS="$SERVER_NAME"
HTTP_PROTOCOL="https"
else
SERVER_NAME="localhost"
HTTP_ADDRESS="$SERVER_NAME:8080"
HTTP_PROTOCOL="http"
fi
echo "ServerName $SERVER_NAME" | sudo tee /etc/apache2/conf-available/global-servername.conf
sudo a2enconf global-servername
# Setup drush
export HTTP_ADDRESS
export HTTP_PROTOCOL
templater.sh /usr/local/share/drush/example.drush.yml > web/sites/default/drush.yml
# set httpd port to be publicly accessible
if [[ -n "$CODESPACE_NAME" ]]; then
gh codespace ports visibility 8080:public -c $CODESPACE_NAME
fi
# Run local devcontainer lifecycle scripts
if [ -x .devcontainer/postCreate.sh ]; then
.devcontainer/postCreate.sh
fi
}
_devcontainer_post_create_desc='runs after the devcontainer is created'
_devcontainer_post_create_help='
This command implements the `postCreateCommand` lifecycle event for dev containers.
# Usage
Add the following to your `devcontainer.json` file:
``` json
{
"postCreateCommand": "uceap devcontainer-post-create"
}
```
## Description
This command is the last of three that finalizes container setup when a dev container is created. It happens after `updateContentCommand` and once the dev container has been assigned to a user for the first time.
Cloud services can use this command to take advantage of user specific secrets and permissions.
'