Skip to content

Commit bcca42b

Browse files
Merge pull request #90 from kevinbackhouse/devcontainer-improvements
devcontainer improvements
2 parents 7e6e599 + 7d9eef0 commit bcca42b

File tree

4 files changed

+36
-30
lines changed

4 files changed

+36
-30
lines changed

.devcontainer/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
99
&& apt-get clean \
1010
&& rm -rf /var/lib/apt/lists/*
1111

12+
# Install CodeQL CLI
13+
RUN curl -Ls -o /tmp/codeql.zip https://github.com/github/codeql-cli-binaries/releases/latest/download/codeql-linux64.zip \
14+
&& unzip /tmp/codeql.zip -d /opt \
15+
&& mv /opt/codeql /opt/codeql-cli \
16+
&& ln -s /opt/codeql-cli/codeql /usr/local/bin/codeql \
17+
&& rm /tmp/codeql.zip
18+
1219
# Set working directory
1320
WORKDIR /workspaces/seclab-taskflow-agent
1421

.devcontainer/devcontainer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
"extensions": [
2424
"ms-python.python",
2525
"ms-python.vscode-pylance",
26+
"ms-python.vscode-python-envs",
2627
"redhat.vscode-yaml",
2728
"GitHub.copilot",
2829
"GitHub.copilot-chat",
2930
"ms-azuretools.vscode-docker"
3031
],
3132
"settings": {
32-
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
33-
"python.terminal.activateEnvironment": true
33+
"python.useEnvironmentsExtension": true
3434
}
3535
}
3636
},
@@ -39,7 +39,7 @@
3939
// Use 'postCreateCommand' to run commands after the container is created
4040
"postCreateCommand": "bash .devcontainer/post-create.sh",
4141
// Use 'postStartCommand' to run commands when the container starts
42-
// "postStartCommand": "",
42+
"postAttachCommand": "bash .devcontainer/post-attach.sh",
4343
// Environment variables
4444
"containerEnv": {
4545
"PYTHONUNBUFFERED": "1"

.devcontainer/post-attach.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# If running in Codespaces, check for necessary secrets and print error if missing
5+
if [ -v CODESPACES ]; then
6+
echo "🔐 Running in Codespaces - injecting secrets from Codespaces settings..."
7+
if [ ! -v COPILOT_TOKEN ]; then
8+
echo "⚠️ Running in Codespaces - please add COPILOT_TOKEN to your Codespaces secrets"
9+
fi
10+
if [ ! -v GITHUB_PERSONAL_ACCESS_TOKEN ]; then
11+
echo "⚠️ Running in Codespaces - please add GITHUB_PERSONAL_ACCESS_TOKEN to your Codespaces secrets"
12+
fi
13+
fi
14+
15+
echo "💡 Remember to activate the virtual environment: source .venv/bin/activate"

.devcontainer/post-create.sh

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,21 @@ python -m pip install --upgrade pip
1414
python -m pip install hatch
1515
hatch build
1616

17-
# If running in Codespaces, check for necessary secrets and print error if missing
18-
if [ -n "$CODESPACES" ]; then
19-
echo "🔐 Running in Codespaces - injecting secrets from Codespaces settings..."
20-
if [ -n "$COPILOT_TOKEN" ]; then
21-
echo "Running in Codespaces - please add COPILOT_TOKEN to your Codespaces secrets"
22-
fi
23-
if [ -n "$GITHUB_AUTH_HEADER" ]; then
24-
echo "Running in Codespaces - please add GITHUB_AUTH_HEADER to your Codespaces secrets"
25-
fi
26-
fi
27-
28-
# Create .env file if it doesn't exist
29-
if [ ! -f .env ]; then
30-
echo "📝 Creating .env template..."
31-
cat > .env << 'EOF'
32-
33-
# Optional: CodeQL database base path
34-
CODEQL_DBS_BASE_PATH=/workspaces/seclab-taskflow-agent/my_data
35-
36-
EOF
37-
echo "⚠️ Please configure the enviroment or your .env file with required tokens!"
38-
fi
17+
# Install this package from local directory.
18+
pip install -e .
3919

4020
# Create logs directory if it doesn't exist
4121
mkdir -p logs
4222

4323
# Create optional data directories
44-
mkdir -p my_data
24+
mkdir -p data
25+
26+
# Create .env file if it doesn't exist
27+
if [ ! -f .env ]; then
28+
echo "📝 Creating .env template..."
29+
echo "# Optional: CodeQL database base path" >> .env
30+
echo "CODEQL_DBS_BASE_PATH=$(realpath data)" >> .env
31+
echo "⚠️ Please configure the environment or your .env file with required tokens!"
32+
fi
4533

4634
echo "✅ Development environment setup complete!"
47-
echo ""
48-
echo "📋 Next steps:"
49-
echo "Configure your environment with COPILOT_TOKEN and GITHUB_AUTH_HEADER as needed."
50-
echo "💡 Remember to activate the virtual environment: source .venv/bin/activate"

0 commit comments

Comments
 (0)