mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
adding to dev container to create shared network on start up
This commit is contained in:
parent
ea2e948f72
commit
6d4942c013
3 changed files with 31 additions and 1 deletions
|
|
@ -4,6 +4,7 @@
|
|||
"service": "model-backend",
|
||||
"remoteUser": "vscode",
|
||||
"workspaceFolder": "/workspaces/model",
|
||||
"initializeCommand": "docker network create shared-dev 2>/dev/null || true",
|
||||
"postStartCommand": "bash .devcontainer/backend/post-install.sh",
|
||||
"mounts": [
|
||||
"source=${localEnv:HOME},target=/workspaces/home,type=bind",
|
||||
|
|
|
|||
10
Makefile
10
Makefile
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
PYTHON = python
|
||||
|
||||
.PHONY: setup test lint typecheck check clean
|
||||
.PHONY: setup test lint typecheck check clean network-setup dev-setup
|
||||
|
||||
# Install dev dependencies + tox
|
||||
setup:
|
||||
|
|
@ -28,3 +28,11 @@ check: lint typecheck test
|
|||
# Clean up tox environments
|
||||
clean:
|
||||
rm -rf .tox
|
||||
|
||||
# Create shared Docker network required by dev container (idempotent)
|
||||
network-setup:
|
||||
docker network create shared-dev 2>/dev/null || true
|
||||
|
||||
# First-time dev environment setup
|
||||
dev-setup: network-setup
|
||||
@echo "Dev environment ready. Open the repo in VS Code and select 'Reopen in Container'."
|
||||
|
|
|
|||
21
README.md
21
README.md
|
|
@ -8,6 +8,27 @@ The different folders in this repository relate to services
|
|||
that can be used independently, or can be imported and used as
|
||||
part of a larger application
|
||||
|
||||
# Getting Started
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- [Docker Desktop](https://www.docker.com/products/docker-desktop/)
|
||||
- [VS Code](https://code.visualstudio.com/) with the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
|
||||
|
||||
## Dev Container Setup
|
||||
|
||||
This repo uses a Docker Compose-based dev container. The `model-backend` service joins a `shared-dev` Docker network so it can communicate with other local services (e.g. a frontend container) running on your machine.
|
||||
|
||||
**VS Code users:** The `initializeCommand` in `devcontainer.json` creates the `shared-dev` network automatically before the container starts. No manual step required — just open the repo and select **Reopen in Container**.
|
||||
|
||||
**Non-VS Code / CI workflows:** Run the following once before starting the container:
|
||||
|
||||
```commandline
|
||||
make dev-setup
|
||||
```
|
||||
|
||||
This is idempotent and safe to re-run if the network already exists.
|
||||
|
||||
# Folders
|
||||
|
||||
### backend/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue