Skip to content
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

Devcontainer support that will enable windows and all other vscode users including Mac to develop SuperDuperDB in a safe environment #1531

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Use an official Ubuntu image as a parent image
FROM ubuntu:latest

# Install necessary packages
RUN apt-get update && \
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release \
build-essential \
git \
sudo \
pandoc \
make \
python3.11 \
python3.11-venv

# Install Node.js 20 for Doc Site
RUN curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash - && \
sudo apt-get install -y nodejs

# Set environment variable

# Create a virtual environment named .venv
RUN python3.11 -m venv .venv

ENV PATH="/.venv/bin:$PATH"
ENV PYTHONUNBUFFERED 1

# Activate the virtual environment and install piptools
RUN python3.11 -m pip install pip-tools

# Activate the virtual environment and install required Python packages
RUN python3.11 -m pip install pytest ipykernel jupyter black interrogate ruff ibis ibis-framework pydantic mypy

# # Copy the pyproject.toml file
# COPY pyproject.toml ./

# # Activate the virtual environment and install development dependencies
# RUN python3.11 -m pip install -e '.[dev]'

# Set the default command to run when the container starts
CMD ["/bin/bash"]
44 changes: 44 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
{
// Name for the dev container
"name": "superduperdb",
// Point to a Docker Compose file
"dockerComposeFile": "docker-compose.yaml",
// Required when using Docker Compose. The name of the service to connect to once running
"service": "superduperdb",
// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
// Prevent the container from shutting down
"overrideCommand": true,
// Features to add to the dev container. More info: https://containers.dev/features
"features": {
// "ghcr.io/devcontainers/features/docker-in-docker:2": {}
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
"27017:27017",
"3000:3000"
],
// Postcommands are little bit shaky
// "postCreateCommand": ". .venv/bin/activate && pip install --upgrade pip-tools && pip install -e '.[dev]' && pip install pytest ipykernel jupyter black interrogate ruff",
// "postAttachCommand": ". .venv/bin/activate",
"postStartCommand": "echo 127.0.0.1 mongodb | sudo tee -a /etc/hosts",
// Configure tool-specific properties
"postAttachCommand": ". .venv/bin/activate",
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"donjayamanne.python-environment-manager",
"ms-python.black-formatter",
"charliermarsh.ruff",
"ms-toolsai.jupyter"
]
}
},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "root"
}
44 changes: 44 additions & 0 deletions .devcontainer/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version: '3'
services:
# ------------------------------
# MongoDB Database
# ------------------------------
superduperdb:
build:
dockerfile: .devcontainer/Dockerfile
context: ..
volumes:
# Update this to wherever you want VS Code to mount the folder of your project.
- ../..:/workspaces:cached
networks:
- superduperdb-network
extra_hosts:
- 'mongodb:127.0.0.1'
# environment:
# MONGO_ROOT_USERNAME: root
# MONGO_ROOT_PASSWORD: password
depends_on:
- mongodb
mongodb:
image: mongo:6
hostname: mongodb
restart: unless-stopped
# environment:
# MONGO_INITDB_ROOT_USERNAME: root
# MONGO_INITDB_ROOT_PASSWORD: password
volumes:
- ../.superduperdb:/data/mongodb6
ports:
- '27017:27017'
command:
[
'/bin/sh',
'-c',
'mongod --replSet rs0 --port 27017 --bind_ip 0.0.0.0 --dbpath /data/mongodb6/',
]
networks:
- superduperdb-network

networks:
superduperdb-network:
driver: bridge
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,4 @@ push_demo: ## Push the superduperdb/demo:latest image

@echo "===> release superduperdb/demo:latest <==="
docker tag superduperdb/demo:$(RELEASE_VERSION:v%=%) superduperdb/demo:latest
docker push superduperdb/demo:latest


docker push superduperdb/demo:latest