-
Notifications
You must be signed in to change notification settings - Fork 39
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
Add initial devcontainer configuration #1098
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM mcr.microsoft.com/devcontainers/python:1-3.11-bullseye | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
|
||
# Install pre-commit | ||
RUN pip install pre-commit | ||
|
||
# [Optional] If your requirements rarely change, uncomment this section to add them to the image. | ||
# COPY requirements.txt /tmp/pip-tmp/ | ||
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ | ||
# && rm -rf /tmp/pip-tmp | ||
|
||
# [Optional] Uncomment this section to install additional OS packages. | ||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
# && apt-get -y install --no-install-recommends <your-package-list-here> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "Python 3 & PostgreSQL", | ||
"dockerComposeFile": "docker-compose.yml", | ||
"service": "app", | ||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", | ||
"features": {}, | ||
"forwardPorts": [8000, 5432], | ||
"postCreateCommand": "pip install --user -r requirements.txt && pre-commit install" | ||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,36 @@ | ||||||
version: "3.8" | ||||||
|
||||||
services: | ||||||
app: | ||||||
build: | ||||||
context: .. | ||||||
dockerfile: .devcontainer/Dockerfile | ||||||
|
||||||
volumes: | ||||||
- ../..:/workspaces:cached | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚨 suggestion (security): Volume mount path might be too broad Mounting
Suggested change
|
||||||
|
||||||
# Overrides default command so things don't shut down after the process ends. | ||||||
command: sleep infinity | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Using While
Suggested change
|
||||||
|
||||||
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. | ||||||
network_mode: service:db | ||||||
|
||||||
environment: | ||||||
DATABASE_URL: "postgres://postgres:postgres@db:5432/postgres" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚨 issue (security): Hard-coded database URL found. It's recommended to use environment variables to store sensitive information like database URLs to avoid exposing them in the codebase. |
||||||
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally. | ||||||
# (Adding the "ports" property to this file will not forward from a Codespace.) | ||||||
|
||||||
db: | ||||||
image: postgres:latest | ||||||
restart: unless-stopped | ||||||
volumes: | ||||||
- postgres-data:/var/lib/postgresql/data | ||||||
environment: | ||||||
POSTGRES_USER: postgres | ||||||
POSTGRES_DB: postgres | ||||||
POSTGRES_PASSWORD: postgres | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚨 issue (security): Hard-coded PostgreSQL password found. Consider using environment variables to store sensitive information like database passwords to enhance security. |
||||||
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. | ||||||
# (Adding the "ports" property to this file will not forward from a Codespace.) | ||||||
|
||||||
volumes: | ||||||
postgres-data: |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,12 @@ | ||||||
# To get started with Dependabot version updates, you'll need to specify which | ||||||
# package ecosystems to update and where the package manifests are located. | ||||||
# Please see the documentation for more information: | ||||||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||||||
# https://containers.dev/guide/dependabot | ||||||
|
||||||
version: 2 | ||||||
updates: | ||||||
- package-ecosystem: "devcontainers" | ||||||
directory: "/" | ||||||
schedule: | ||||||
interval: weekly | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Consider adjusting the update interval A weekly update interval might be too frequent for some projects. Depending on the project's needs, a bi-weekly or monthly interval could reduce noise and workload.
Suggested change
|
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.
issue (bug_risk): Potential issue with
pip install --user
Using
pip install --user
can lead to issues with package paths and permissions. Consider using a virtual environment instead.