Skip to content
Open
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
15 changes: 15 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ARG BASE_IMAGE=drive:backend-development
FROM ${BASE_IMAGE}

USER root

# Install tools needed by Zed (basedpyright LSP requires node)
RUN apk add --no-cache nodejs npm bash

# Create a writable home and register the dev user with a valid shell
ARG DEV_UID=1000
RUN mkdir -p /tmp/dev-home && chown ${DEV_UID}:0 /tmp/dev-home \
&& echo "default:x:${DEV_UID}:0:default user:/tmp/dev-home:/bin/sh" >> /etc/passwd

USER default
ENV HOME=/tmp/dev-home
19 changes: 19 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "Drive - La Suite Numerique",
"dockerComposeFile": [
"../compose.yaml",
"docker-compose.override.yml"
],
"service": "devcontainer",
"workspaceFolder": "/workspace",
"overrideCommand": true,
"shutdownAction": "none",
"containerUser": "default",
"updateRemoteUserUID": false,
"initializeCommand": {
"network": "docker network create lasuite-network || true",
"envfiles": "touch env.d/development/crowdin.local env.d/development/common.local env.d/development/postgresql.local env.d/development/kc_postgresql.local",
"dirs": "mkdir -p data/media data/static"
},
"forwardPorts": [3000, 8071, 8080, 8083, 9000, 9001, 9980, 9981]
}
11 changes: 11 additions & 0 deletions .devcontainer/docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
devcontainer:
build:
context: .
dockerfile: .devcontainer/Dockerfile
args:
BASE_IMAGE: drive:backend-development
DEV_UID: ${DOCKER_USER:-1000}
user: "default"
volumes:
- ..:/workspace:cached
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ db.sqlite3
.idea/
.vscode/
*.iml
.devcontainer

# Various
.turbo
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ build-frontend: ## build the frontend container
@$(COMPOSE) build frontend-dev $(cache)
.PHONY: build-frontend-development

down: ## stop and remove containers, networks, images, and volumes
down: stop-devcontainer ## stop and remove containers, networks, images, and volumes
@$(COMPOSE) down
rm -rf data/postgresql.*
.PHONY: down
Expand Down Expand Up @@ -171,10 +171,18 @@ status: ## an alias for "docker compose ps"
@$(COMPOSE) ps
.PHONY: status

stop: ## stop the development server using Docker
stop: stop-devcontainer ## stop the development server using Docker
@$(COMPOSE) stop
.PHONY: stop

COMPOSE_DEVCONTAINER = docker compose -f compose.yaml -f .devcontainer/docker-compose.override.yml

stop-devcontainer: ## stop the devcontainer service if running
@if $(COMPOSE_DEVCONTAINER) ps devcontainer --status running -q 2>/dev/null | grep -q .; then \
$(COMPOSE_DEVCONTAINER) stop devcontainer; \
fi
.PHONY: stop-devcontainer

# -- Backend

demo: ## flush db then create a demo for load testing purpose
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,18 @@ To start all the services, except the frontend container, you can use the follow
$ make run-backend
```

### Dev Container (Zed / VS Code)

You can develop inside a container using the [Dev Containers](https://containers.dev/) specification.
This is supported by **Zed** and **VS Code** out of the box.

1. Start the project with `make run` (or `make bootstrap` on first use).
2. Open the project in your IDE β€” it will detect `.devcontainer/devcontainer.json` and offer to reopen in a container.

The dev container runs alongside `app-dev` as a dedicated IDE workspace with
Python dependencies and LSP support. It shares the same source files via volume
mounts, so your changes are immediately reflected in the running application.

### Django admin

You can access the Django admin site at
Expand Down