forked from ShishirPatil/gorilla
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RAFT DevContainer for GitHub Codespaces (ShishirPatil#379)
This PR adds support for a GitHub Codespaces Dev Container for the `raft` sub-project: - Dev Container config `RAFT` with direnv with shell hooks - Adds `Open in GitHub Codespaces` badge to README.md pre-configured with `RAFT` config - post-create script creates env using the python venv module and points direnv at it - Upgrades pip and installs requirements Note: The Dev Container configuration can also be used locally in VS Code in addition to remotely in GitHub Codespaces. This PR is similar to ShishirPatil#351 but targets the `raft` sub project. Co-authored-by: Shishir Patil <[email protected]>
- Loading branch information
1 parent
3f91544
commit 6dff506
Showing
6 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,4 @@ | ||
FROM mcr.microsoft.com/devcontainers/python:1-3.10 | ||
|
||
RUN curl -sfL https://direnv.net/install.sh | bash && \ | ||
echo 'eval "$(direnv hook bash)"' >> /etc/bash.bashrc |
This file contains 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,32 @@ | ||
// 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 | ||
{ | ||
"name": "RAFT", | ||
|
||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"build": { | ||
// Path is relative to the devcontainer.json file. | ||
"dockerfile": "Dockerfile" | ||
}, | ||
|
||
// 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": [], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "sh ${containerWorkspaceFolder}/.devcontainer/raft/post-create.sh", | ||
|
||
// Configure tool-specific properties. | ||
"customizations": { | ||
"codespaces": { | ||
"openFiles": [ | ||
"raft/README.md" | ||
] | ||
} | ||
} | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
This file contains 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,16 @@ | ||
#!/bin/bash | ||
|
||
cd raft | ||
|
||
echo "Allowing raft direnv" | ||
direnv allow | ||
|
||
echo "Creating virtual environment" | ||
python3 -m venv .venv | ||
. ./.venv/bin/activate | ||
|
||
echo "Upgrading pip" | ||
pip install --upgrade pip | ||
|
||
echo "Installing requirements" | ||
pip install -r requirements.txt |
This file contains 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,3 @@ | ||
# Tell direnv to use pre configured venv | ||
export VIRTUAL_ENV=./.venv | ||
layout python |
This file contains 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 @@ | ||
.venv/ |
This file contains 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