Skip to content

Commit 46a72ee

Browse files
committed
Set up development environment with Docker, Docker Compose, and PostgreSQL; update README and add security guidelines
1 parent 4c062b7 commit 46a72ee

File tree

13 files changed

+543
-131
lines changed

13 files changed

+543
-131
lines changed

.devcontainer/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM mcr.microsoft.com/devcontainers/python:1-3-bookworm
2+
3+
ENV PYTHONUNBUFFERED 1
4+
5+
# [Optional] If your requirements rarely change, uncomment this section to add them to the image.
6+
# COPY requirements.txt /tmp/pip-tmp/
7+
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
8+
# && rm -rf /tmp/pip-tmp
9+
10+
# [Optional] Uncomment this section to install additional OS packages.
11+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
12+
# && apt-get -y install --no-install-recommends <your-package-list-here>

.devcontainer/devcontainer.json

Lines changed: 26 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,28 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2-
// README at: https://github.com/devcontainers/templates/tree/main/src/go
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/postgres
33
{
4-
"name": "Game of Life Walkthrough",
5-
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6-
"image": "mcr.microsoft.com/devcontainers/universal:latest",
7-
8-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
9-
"forwardPorts": [
10-
3000
11-
],
12-
13-
// Use 'postCreateCommand' to run commands after the container is created.
14-
// "postCreateCommand": ""
15-
16-
// Configure tool-specific properties.
17-
"customizations": {
18-
"codespaces": {
19-
"openFiles": [
20-
"index.html",
21-
"README.md"
22-
]
23-
},
24-
"vscode": {
25-
"extensions": [
26-
"GitHub.codespaces",
27-
"GitHub.copilot",
28-
"GitHub.copilot-chat",
29-
"github.copilot-workspace",
30-
"GitHub.remotehub",
31-
"github.vscode-github-actions",
32-
"GitHub.vscode-pull-request-github",
33-
"ms-vscode.live-server"
34-
]
35-
}
36-
}
37-
38-
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
39-
// "remoteUser": "root"
40-
}
4+
"name": "Python 3 & PostgreSQL",
5+
"dockerComposeFile": "docker-compose.yml",
6+
"service": "app",
7+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
8+
"features": {
9+
"ghcr.io/devcontainers/features/github-cli:1": {},
10+
"ghcr.io/devcontainers/features/node:1": {}
11+
}
12+
13+
// Features to add to the dev container. More info: https://containers.dev/features.
14+
// "features": {},
15+
16+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
17+
// This can be used to network with other containers or the host.
18+
// "forwardPorts": [5000, 5432],
19+
20+
// Use 'postCreateCommand' to run commands after the container is created.
21+
// "postCreateCommand": "pip install --user -r requirements.txt",
22+
23+
// Configure tool-specific properties.
24+
// "customizations": {},
25+
26+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
27+
// "remoteUser": "root"
28+
}

.devcontainer/docker-compose.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
version: '3.8'
2+
3+
services:
4+
app:
5+
build:
6+
context: ..
7+
dockerfile: .devcontainer/Dockerfile
8+
9+
volumes:
10+
- ../..:/workspaces:cached
11+
12+
# Overrides default command so things don't shut down after the process ends.
13+
command: sleep infinity
14+
15+
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
16+
network_mode: service:db
17+
18+
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
19+
# (Adding the "ports" property to this file will not forward from a Codespace.)
20+
21+
db:
22+
image: postgres:latest
23+
restart: unless-stopped
24+
volumes:
25+
- postgres-data:/var/lib/postgresql/data
26+
environment:
27+
POSTGRES_USER: postgres
28+
POSTGRES_DB: postgres
29+
POSTGRES_PASSWORD: postgres
30+
31+
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
32+
# (Adding the "ports" property to this file will not forward from a Codespace.)
33+
34+
volumes:
35+
postgres-data:

.gitignore

Lines changed: 178 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,181 @@
11
.vscode
22
# Bruno adds a dir to your vscode workspace
33
Planventure
4-
__pycache__
4+
__pycache__
5+
.DS_Store
6+
7+
# Add the .gitignore from https://github.com/github/gitignore/blob/main/Python.gitignore
8+
# Byte-compiled / optimized / DLL files
9+
__pycache__/
10+
*.py[cod]
11+
*$py.class
12+
13+
# C extensions
14+
*.so
15+
16+
# Distribution / packaging
17+
.Python
18+
build/
19+
develop-eggs/
20+
dist/
21+
downloads/
22+
eggs/
23+
.eggs/
24+
lib/
25+
lib64/
26+
parts/
27+
sdist/
28+
var/
29+
wheels/
30+
share/python-wheels/
31+
*.egg-info/
32+
.installed.cfg
33+
*.egg
34+
MANIFEST
35+
36+
# PyInstaller
37+
# Usually these files are written by a python script from a template
38+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
39+
*.manifest
40+
*.spec
41+
42+
# Installer logs
43+
pip-log.txt
44+
pip-delete-this-directory.txt
45+
46+
# Unit test / coverage reports
47+
htmlcov/
48+
.tox/
49+
.nox/
50+
.coverage
51+
.coverage.*
52+
.cache
53+
nosetests.xml
54+
coverage.xml
55+
*.cover
56+
*.py,cover
57+
.hypothesis/
58+
.pytest_cache/
59+
cover/
60+
61+
# Translations
62+
*.mo
63+
*.pot
64+
65+
# Django stuff:
66+
*.log
67+
local_settings.py
68+
db.sqlite3
69+
db.sqlite3-journal
70+
71+
# Flask stuff:
72+
instance/
73+
.webassets-cache
74+
75+
# Scrapy stuff:
76+
.scrapy
77+
78+
# Sphinx documentation
79+
docs/_build/
80+
81+
# PyBuilder
82+
.pybuilder/
83+
target/
84+
85+
# Jupyter Notebook
86+
.ipynb_checkpoints
87+
88+
# IPython
89+
profile_default/
90+
ipython_config.py
91+
92+
# pyenv
93+
# For a library or package, you might want to ignore these files since the code is
94+
# intended to run in multiple environments; otherwise, check them in:
95+
# .python-version
96+
97+
# pipenv
98+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
99+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
100+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
101+
# install all needed dependencies.
102+
#Pipfile.lock
103+
104+
# UV
105+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
106+
# This is especially recommended for binary packages to ensure reproducibility, and is more
107+
# commonly ignored for libraries.
108+
#uv.lock
109+
110+
# poetry
111+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
112+
# This is especially recommended for binary packages to ensure reproducibility, and is more
113+
# commonly ignored for libraries.
114+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
115+
#poetry.lock
116+
117+
# pdm
118+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
119+
#pdm.lock
120+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
121+
# in version control.
122+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
123+
.pdm.toml
124+
.pdm-python
125+
.pdm-build/
126+
127+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128+
__pypackages__/
129+
130+
# Celery stuff
131+
celerybeat-schedule
132+
celerybeat.pid
133+
134+
# SageMath parsed files
135+
*.sage.py
136+
137+
# Environments
138+
.env
139+
.venv
140+
env/
141+
venv/
142+
ENV/
143+
env.bak/
144+
venv.bak/
145+
146+
# Spyder project settings
147+
.spyderproject
148+
.spyproject
149+
150+
# Rope project settings
151+
.ropeproject
152+
153+
# mkdocs documentation
154+
/site
155+
156+
# mypy
157+
.mypy_cache/
158+
.dmypy.json
159+
dmypy.json
160+
161+
# Pyre type checker
162+
.pyre/
163+
164+
# pytype static type analyzer
165+
.pytype/
166+
167+
# Cython debug symbols
168+
cython_debug/
169+
170+
# PyCharm
171+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
172+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
173+
# and can be added to the global gitignore or merged into this file. For a more nuclear
174+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
175+
#.idea/
176+
177+
# Ruff stuff:
178+
.ruff_cache/
179+
180+
# PyPI configuration file
181+
.pypirc

README.md

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ Before you begin, ensure you have the following:
2323

2424
If you prefer to develop locally, follow the steps below:
2525

26-
1. Clone the repository to your local machine and switch to the `apistart` branch:
26+
1.Fork and clone the repository and navigate to the [planventue-api](/planventure-api/) directory:
2727
```sh
28-
git clone https://github.com/github-samples/planventure.git
29-
git switch apistart
28+
cd planventure-api
3029
```
3130

3231
2. Create a virtual environment and activate it:
@@ -35,24 +34,19 @@ python -m venv venv
3534
source venv/bin/activate # On Windows: venv\Scripts\activate
3635
```
3736

38-
3. Navigate to the [planventue-api](/planventure-api/) directory:
39-
```sh
40-
cd planventure-api
41-
```
42-
43-
4. Install the required dependencies:
37+
3. Install the required dependencies:
4438
```sh
4539
pip install -r requirements.txt
4640
```
4741

48-
5. Create an `.env` file based on [.sample.env](.sample.env):
42+
4. Create an `.env` file based on [.sample.env](/planventure-api/.sample.env):
4943
```sh
5044
cp .sample.env .env
5145
```
5246

53-
6. Start the Flask development server:
47+
5. Start the Flask development server:
5448
```sh
55-
flask run --debug
49+
flask run
5650
```
5751

5852
## 📚 API Endpoints
@@ -61,5 +55,4 @@ flask run --debug
6155

6256
## 📝 License
6357

64-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
65-
Footer
58+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

SECURITY.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Security
2+
3+
Thanks for helping make GitHub safe for everyone.
4+
5+
GitHub takes the security of our software products and services seriously, including all of the open source code repositories managed through our GitHub organizations, such as [GitHub](https://github.com/GitHub).
6+
7+
Even though [open source repositories are outside of the scope of our bug bounty program](https://bounty.github.com/index.html#scope) and therefore not eligible for bounty rewards, we will ensure that your finding gets passed along to the appropriate maintainers for remediation.
8+
9+
## Reporting Security Issues
10+
11+
If you believe you have found a security vulnerability in any GitHub-owned repository, please report it to us through coordinated disclosure.
12+
13+
**Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.**
14+
15+
Instead, please send an email to opensource-security[@]github.com.
16+
17+
Please include as much of the information listed below as you can to help us better understand and resolve the issue:
18+
19+
* The type of issue (e.g., buffer overflow, SQL injection, or cross-site scripting)
20+
* Full paths of source file(s) related to the manifestation of the issue
21+
* The location of the affected source code (tag/branch/commit or direct URL)
22+
* Any special configuration required to reproduce the issue
23+
* Step-by-step instructions to reproduce the issue
24+
* Proof-of-concept or exploit code (if possible)
25+
* Impact of the issue, including how an attacker might exploit the issue
26+
27+
This information will help us triage your report more quickly.
28+
29+
## Policy
30+
31+
See [GitHub's Safe Harbor Policy](https://docs.github.com/en/site-policy/security-policies/github-bug-bounty-program-legal-safe-harbor#1-safe-harbor-terms)

0 commit comments

Comments
 (0)