Skip to content

Commit 74b37a0

Browse files
authored
Try automatically updating the port visibility in codespaces (#54424)
1 parent 9d4d6dc commit 74b37a0

File tree

3 files changed

+5
-61
lines changed

3 files changed

+5
-61
lines changed

.devcontainer/Dockerfile

-16
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,3 @@
33
# [Choice] Node.js version
44
ARG VARIANT="dev-22-bullseye"
55
FROM mcr.microsoft.com/devcontainers/javascript-node:${VARIANT}
6-
7-
# [Optional] Uncomment this section to install additional OS packages.
8-
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
9-
# && apt-get -y install --no-install-recommends <your-package-list-here>
10-
11-
# [Optional] Uncomment if you want to install an additional version of node using nvm
12-
# ARG EXTRA_NODE_VERSION=10
13-
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
14-
15-
# [Optional] Uncomment if you want to install more global node modules
16-
# RUN su node -c "npm install -g <your-package-list-here>"
17-
18-
# Install the GitHub CLI see:
19-
# https://github.com/microsoft/vscode-dev-containers/blob/3d59f9fe37edb68f78874620f33dac5a62ef2b93/script-library/docs/github.md
20-
COPY library-scripts/github-debian.sh /tmp/library-scripts/
21-
RUN apt-get update && bash /tmp/library-scripts/github-debian.sh

.devcontainer/devcontainer.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
// Install features. Type 'feature' in the VS Code command palette for a full list.
1313
"features": {
14-
"sshd": "latest"
14+
"sshd": "latest",
15+
"ghcr.io/devcontainers/features/github-cli:1": {}
1516
},
1617

1718
"customizations": {
@@ -53,13 +54,15 @@
5354

5455
"portsAttributes": {
5556
"4000": {
56-
"label": "Preview"
57+
"label": "Review"
5758
}
5859
},
5960

6061
// Lifecycle commands
6162
"onCreateCommand": "npm ci",
6263
"postStartCommand": "nohup bash -c 'npm start &'",
64+
// Set the port to be public
65+
"postAttachCommand": "gh cs ports visibility 4000:public -c \"$CODESPACE_NAME\"",
6366

6467
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
6568
"remoteUser": "node",

.devcontainer/library-scripts/github-debian.sh

-43
This file was deleted.

0 commit comments

Comments
 (0)