$npx -y skills add digitalocean-labs/do-app-platform-skills --skill devcontainersSet up local development environments with production parity for DigitalOcean App Platform. Use when setting up local dev, adding devcontainer to a project, running App Platform apps locally, or configuring backing services (Postgres, Redis, Kafka, S3).
| 1 | # Dev Containers Skill |
| 2 | |
| 3 | Set up local development environments with production parity for DigitalOcean App Platform applications. |
| 4 | |
| 5 | **Primary value**: 30-second feedback loops instead of 7-minute deploy cycles. |
| 6 | |
| 7 | ## Quick Decision |
| 8 | |
| 9 | ``` |
| 10 | What do you need? |
| 11 | ├── New project setup → Workflow 1 |
| 12 | ├── Existing App Platform app → Workflow 2 |
| 13 | └── CLI-only testing (no IDE) → See cli-workflow.md |
| 14 | ``` |
| 15 | |
| 16 | --- |
| 17 | |
| 18 | ## Quick Start: Clone and Copy |
| 19 | |
| 20 | ```bash |
| 21 | # Clone the reference devcontainer |
| 22 | git clone --depth 1 https://github.com/bikramkgupta/do-app-devcontainer.git /tmp/devcontainer-ref |
| 23 | |
| 24 | # Copy to your project |
| 25 | cp -r /tmp/devcontainer-ref/.devcontainer /path/to/your-project/ |
| 26 | |
| 27 | # Clean up |
| 28 | rm -rf /tmp/devcontainer-ref |
| 29 | ``` |
| 30 | |
| 31 | Then customize `COMPOSE_PROFILES` in `.devcontainer/devcontainer.json`: |
| 32 | ```json |
| 33 | "containerEnv": { |
| 34 | "COMPOSE_PROFILES": "app,postgres,minio" |
| 35 | } |
| 36 | ``` |
| 37 | |
| 38 | --- |
| 39 | |
| 40 | ## Available Profiles |
| 41 | |
| 42 | | Profile | Service | Use When | |
| 43 | |---------|---------|----------| |
| 44 | | `postgres` | PostgreSQL 18 | SQL database | |
| 45 | | `mysql` | MySQL 8 | MySQL database | |
| 46 | | `mongo` | MongoDB 8 | Document database | |
| 47 | | `valkey` | Valkey 8 | Redis-compatible cache | |
| 48 | | `kafka` | Confluent Kafka 7.7 | Message streaming | |
| 49 | | `minio` | RustFS | S3-compatible storage | |
| 50 | | `opensearch` | OpenSearch 3.0 | Full-text search | |
| 51 | |
| 52 | --- |
| 53 | |
| 54 | ## Connection Strings |
| 55 | |
| 56 | | Service | Connection String | |
| 57 | |---------|-------------------| |
| 58 | | PostgreSQL | `postgresql://postgres:password@postgres:5432/app` | |
| 59 | | MySQL | `mysql://mysql:mysql@mysql:3306/app` | |
| 60 | | MongoDB | `mongodb://mongodb:mongodb@mongo:27017/app?authSource=admin` | |
| 61 | | Valkey | `redis://valkey:6379` | |
| 62 | | Kafka | `kafka:9092` | |
| 63 | | RustFS | `http://minio:9000` (creds: `rustfsadmin/rustfsadmin`) | |
| 64 | | OpenSearch | `http://opensearch:9200` | |
| 65 | |
| 66 | **Inside container**: Use service names (e.g., `postgres:5432`) |
| 67 | **From host**: Use `docker compose port` to find mapped ports |
| 68 | |
| 69 | --- |
| 70 | |
| 71 | ## Workflow 1: New Project Setup |
| 72 | |
| 73 | **Trigger:** "I'm building a [language] app with [services]" |
| 74 | |
| 75 | 1. Copy `.devcontainer/` from reference repo (see Quick Start) |
| 76 | 2. Set `COMPOSE_PROFILES` based on required services |
| 77 | 3. Create `env-devcontainer.example` with connection strings |
| 78 | 4. Open in VS Code/Cursor → "Reopen in Container" |
| 79 | |
| 80 | **devcontainer.json template:** |
| 81 | ```json |
| 82 | { |
| 83 | "name": "App Platform Dev Environment", |
| 84 | "dockerComposeFile": "docker-compose.yml", |
| 85 | "service": "app", |
| 86 | "workspaceFolder": "/workspaces/app", |
| 87 | "features": { |
| 88 | "ghcr.io/devcontainers/features/github-cli:1": {}, |
| 89 | "ghcr.io/devcontainers/features/node:1": {}, |
| 90 | "ghcr.io/devcontainers/features/python:1": {}, |
| 91 | "ghcr.io/devcontainers-extra/features/uv:1": {}, |
| 92 | "ghcr.io/devcontainers-extra/features/digitalocean-cli:1": {}, |
| 93 | "ghcr.io/anthropics/devcontainer-features/claude-code:1": {}, |
| 94 | "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {} |
| 95 | }, |
| 96 | "containerEnv": { |
| 97 | "COMPOSE_PROFILES": "app,postgres" |
| 98 | }, |
| 99 | "initializeCommand": "cd \"${localWorkspaceFolder}\" && bash .devcontainer/init.sh", |
| 100 | "postCreateCommand": ".devcontainer/post-create.sh", |
| 101 | "remoteUser": "vscode", |
| 102 | "shutdownAction": "stopCompose" |
| 103 | } |
| 104 | ``` |
| 105 | |
| 106 | --- |
| 107 | |
| 108 | ## Workflow 2: Add to Existing App Platform App |
| 109 | |
| 110 | **Trigger:** "I have an App Platform app, help me run it locally" |
| 111 | |
| 112 | 1. Read `.do/app.yaml` to detect services |
| 113 | 2. Map App Platform → local containers: |
| 114 | |
| 115 | | App Platform | Local Profile | |
| 116 | |--------------|---------------| |
| 117 | | `databases[].engine: PG` | `postgres` | |
| 118 | | `databases[].engine: MYSQL` | `mysql` | |
| 119 | | `databases[].engine: MONGODB` | `mongo` | |
| 120 | | `databases[].engine: REDIS` | `valkey` | |
| 121 | | Spaces attachment | `minio` | |
| 122 | |
| 123 | 3. Generate environment mapping: |
| 124 | ```bash |
| 125 | # Production (App Platform injects) |
| 126 | # DATABASE_URL=${db.DATABASE_URL} |
| 127 | |
| 128 | # Local Development |
| 129 | DATABASE_URL=postgresql://postgres:password@postgres:5432/app |
| 130 | ``` |
| 131 | |
| 132 | --- |
| 133 | |
| 134 | ## Environment Template |
| 135 | |
| 136 | ```bash |
| 137 | # env-devcontainer.example |
| 138 | |
| 139 | # Database |
| 140 | DATABASE_URL=postgresql://postgres:password@postgres:5432/app |
| 141 | |
| 142 | # Cache |
| 143 | REDIS_URL=redis://valkey:6379 |
| 144 | |
| 145 | # S3-compatible storage (RustFS) |
| 146 | SPACES_ENDPOINT=http://minio:9000 |
| 147 | SPACES_KEY_ID=rustfsadmin |
| 148 | SPACES_SECRET_KEY=rustfsadmin |
| 149 | SPACES_BUCKET_NAME=my-app-local |
| 150 | SPACES_FORCE_PATH_STYLE=true |
| 151 | ``` |
| 152 | |
| 153 | --- |
| 154 | |
| 155 | ## What You Get from Reference Repo |
| 156 | |
| 157 | ``` |
| 158 | .devcontainer/ |
| 159 | ├── devcontainer.json # IDE configuration |
| 160 | ├── docker-compose.yml # All 7 backing services |
| 161 | ├── init.sh # Git worktree support |
| 162 | ├── post-create.sh # Post-creation setup |
| 163 | ├── .env # Generated (gitignored) |
| 164 | └── tests/ # Service connectivity tests |
| 165 | ├── agent-test.sh # E2E validation |
| 166 | ├── run-all-tests.s |