Skip to content

Commit 11999b4

Browse files
authored
Merge pull request #116 from linkorb/improve-devcontainer-local-setup-0000
Improve devcontainer local setup #0000
2 parents c50ca9a + 0c58532 commit 11999b4

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

templates/.devcontainer/devcontainer.json.j2

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
"description": "Packagist access token, required for installation of composer packages from private packagist",
3030
"documentationUrl": "https://packagist.com/orgs/linkorb"
3131
}
32+
{% endif %}
33+
},
34+
"remoteEnv": {
35+
{% if repo.devcontainer.private_packagist and (repo.type in ['application', 'library', 'symfony-bundle'] or repo.type.startswith('php-')) %}
36+
"GITHUB_USER_ON_HOST": "${localEnv:GITHUB_USER}",
37+
"PACKAGIST_TOKEN_ON_HOST": "${localEnv:PACKAGIST_TOKEN}"
3238
{% endif %}
3339
},
3440
"postCreateCommand": ".devcontainer/postCreate.sh",

templates/.devcontainer/postCreate.sh.j2

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#!/usr/bin/env bash
22
# {{ repo_managed }}
33

4-
# Workaround for recent Python versions which prevent global pip package installation without an explicit flag
5-
# or removal of a certain file.
6-
sudo rm /usr/lib/python3.*/EXTERNALLY-MANAGED || true
7-
84
# This is a workaround on an issue with the devcontainer reported on Windows where followup git config commands would
95
# fail. #9067
106
git config --global --add safe.directory /app
@@ -14,7 +10,8 @@ git config commit.template .devcontainer/git/linkorb_commit.template
1410
{% if repo.type in ['application', 'library', 'symfony-bundle'] or repo.type.startswith('php-') %}
1511

1612
{% if repo.devcontainer.private_packagist %}
17-
composer config --global --auth http-basic.repo.packagist.com "$GITHUB_USER" "$PACKAGIST_TOKEN"
13+
composer config --global --auth http-basic.repo.packagist.com \
14+
"${GITHUB_USER:-$GITHUB_USER_ON_HOST}" "${PACKAGIST_TOKEN:-$PACKAGIST_TOKEN_ON_HOST}"
1815
{% endif %}
1916

2017
composer install
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
#!/usr/bin/env bash
22
# {{ repo_managed }}
33

4-
# pre-push composer-unused hook disabled. See Card #8980
5-
if [ -f .git/hooks/pre-push ]; then
6-
diff .devcontainer/git/hooks/pre-push .git/hooks/pre-push
7-
if [ $? -eq 0 ]; then
8-
rm .git/hooks/pre-push
9-
fi
10-
fi
114
{{ repo.devcontainer.postStartCommand|default('') }}

0 commit comments

Comments
 (0)