-
Notifications
You must be signed in to change notification settings - Fork 729
Add dev container to open in GitHub Codespace #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
blackgirlbytes
wants to merge
22
commits into
openai:main
Choose a base branch
from
blackgirlbytes:insert-codespace-name
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
0525a2b
Create devcontainer.json
b209c17
add codespace url
3dc80b7
adding permissions to run file
0def4e0
remove args
3078dd0
move to postCreateCommand
5251c8e
final devcontainer
8426a43
Update README.md
a65aa1c
Update README.md
64b03a0
Update devcontainer.json
d0727a5
no need to use workspaceFolder variable
3ec5efd
incorrect capitalization of GitHub Codespaces
56517d6
remove unnecessary container details
79cf7a0
Update devcontainer.json
ebc2387
add set -e to improve debugging experience
16d93e1
Update .devcontainer/addcodespacename.sh
5111000
adding the chmod until I get the alternative
aab7bca
no need to replace strings for local setup
955a32c
hopefully no need to chmod
cb70223
Make addcodespacename.sh executable
da2f9f1
copy local address update
199c27a
changing devcontainer name
6b57cff
removing unused property
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
blackgirlbytes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Determine the value of SITE_HOST based on whether the project is opened in a Codespace | ||
if [ -z ${CODESPACE_NAME+x} ]; then | ||
blackgirlbytes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
SITE_HOST="http://localhost:5003" | ||
else | ||
SITE_HOST="https://${CODESPACE_NAME}-5003.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}" | ||
fi | ||
|
||
# Replace "localhost:5003" with the value of SITE_HOST in the ai-plugin.json file | ||
sed -i "s#http://localhost:5003#${SITE_HOST}#g" .well-known/ai-plugin.json | ||
|
||
# Replace "localhost:5003" with the value of SITE_HOST in the openapi.yaml file | ||
sed -i "s#http://localhost:5003#${SITE_HOST}#g" openapi.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/python | ||
blackgirlbytes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
"name": "Python 3", | ||
blackgirlbytes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"image": "mcr.microsoft.com/devcontainers/universal:2", | ||
blackgirlbytes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
"forwardPorts": [ | ||
5003 | ||
], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "pip install -r requirements.txt", | ||
"postAttachCommand": ".devcontainer/addcodespacename.sh && python main.py", | ||
"customizations": { | ||
"codespaces": { | ||
"openFiles": [ | ||
".well-known/ai-plugin.json", | ||
"openapi.yaml" | ||
] | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this, we can update the file to have $host placeholder and then replace with host header. For codespaces, the original host is in x-forwarded-host.