forked from molecule-ai/molecule-core
Merge pull request 'feat(local-dev): containerize platform + canvas stack via docker-compose' (#131) from feat/126-containerize-local-platform-stack into main
This commit is contained in:
commit
8e4169cfac
10
canvas/.dockerignore
Normal file
10
canvas/.dockerignore
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Excluded from `docker build` context. Without this, the COPY . . step in
|
||||||
|
# canvas/Dockerfile clobbers the freshly-installed node_modules with the
|
||||||
|
# host's (potentially broken / wrong-arch) copy — the @tailwindcss/oxide
|
||||||
|
# native binary disagreed and broke `next build`.
|
||||||
|
node_modules
|
||||||
|
.next
|
||||||
|
.git
|
||||||
|
*.log
|
||||||
|
.env*
|
||||||
|
!.env.example
|
||||||
@ -1,7 +1,11 @@
|
|||||||
FROM node:22-alpine AS builder
|
FROM node:22-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json package-lock.json* ./
|
COPY package.json package-lock.json* ./
|
||||||
RUN npm install
|
# `npm ci` (not `install`) for lockfile-exact reproducibility.
|
||||||
|
# `--include=optional` ensures the platform-specific @tailwindcss/oxide
|
||||||
|
# native binary lands — without it, postcss fails with "Cannot read
|
||||||
|
# properties of undefined (reading 'All')" at build time.
|
||||||
|
RUN npm ci --include=optional
|
||||||
COPY . .
|
COPY . .
|
||||||
ARG NEXT_PUBLIC_PLATFORM_URL=http://localhost:8080
|
ARG NEXT_PUBLIC_PLATFORM_URL=http://localhost:8080
|
||||||
ARG NEXT_PUBLIC_WS_URL=ws://localhost:8080/ws
|
ARG NEXT_PUBLIC_WS_URL=ws://localhost:8080/ws
|
||||||
|
|||||||
@ -13,6 +13,7 @@ services:
|
|||||||
- pgdata:/var/lib/postgresql/data
|
- pgdata:/var/lib/postgresql/data
|
||||||
networks:
|
networks:
|
||||||
- molecule-monorepo-net
|
- molecule-monorepo-net
|
||||||
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-dev}"]
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-dev}"]
|
||||||
interval: 2s
|
interval: 2s
|
||||||
@ -50,6 +51,7 @@ services:
|
|||||||
- redisdata:/data
|
- redisdata:/data
|
||||||
networks:
|
networks:
|
||||||
- molecule-monorepo-net
|
- molecule-monorepo-net
|
||||||
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "redis-cli", "ping"]
|
test: ["CMD", "redis-cli", "ping"]
|
||||||
interval: 2s
|
interval: 2s
|
||||||
@ -126,6 +128,10 @@ services:
|
|||||||
REDIS_URL: redis://redis:6379
|
REDIS_URL: redis://redis:6379
|
||||||
PORT: "${PLATFORM_PORT:-8080}"
|
PORT: "${PLATFORM_PORT:-8080}"
|
||||||
PLATFORM_URL: "http://platform:${PLATFORM_PORT:-8080}"
|
PLATFORM_URL: "http://platform:${PLATFORM_PORT:-8080}"
|
||||||
|
# Container network namespace is already isolated; "all interfaces"
|
||||||
|
# inside the container = the bridge interface only. The fail-open
|
||||||
|
# default (127.0.0.1) would block host-to-container access.
|
||||||
|
BIND_ADDR: "${BIND_ADDR:-0.0.0.0}"
|
||||||
# Default MOLECULE_ENV=development so the WorkspaceAuth / AdminAuth
|
# Default MOLECULE_ENV=development so the WorkspaceAuth / AdminAuth
|
||||||
# middleware fail-open path activates when ADMIN_TOKEN is unset —
|
# middleware fail-open path activates when ADMIN_TOKEN is unset —
|
||||||
# otherwise the canvas (which runs without a bearer in pure local
|
# otherwise the canvas (which runs without a bearer in pure local
|
||||||
@ -212,8 +218,11 @@ services:
|
|||||||
- "${PLATFORM_PUBLISH_PORT:-8080}:${PLATFORM_PORT:-8080}"
|
- "${PLATFORM_PUBLISH_PORT:-8080}:${PLATFORM_PORT:-8080}"
|
||||||
networks:
|
networks:
|
||||||
- molecule-monorepo-net
|
- molecule-monorepo-net
|
||||||
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:${PLATFORM_PORT:-8080}/health || exit 1"]
|
# Plain GET — `--spider` would issue HEAD, which returns 404 because
|
||||||
|
# /health is registered as GET only.
|
||||||
|
test: ["CMD-SHELL", "wget -qO /dev/null --tries=1 http://localhost:${PLATFORM_PORT:-8080}/health || exit 1"]
|
||||||
interval: 5s
|
interval: 5s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 10
|
retries: 10
|
||||||
@ -251,7 +260,7 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- molecule-monorepo-net
|
- molecule-monorepo-net
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://127.0.0.1:${CANVAS_PORT:-3000} || exit 1"]
|
test: ["CMD-SHELL", "wget -qO /dev/null --tries=1 http://127.0.0.1:${CANVAS_PORT:-3000} || exit 1"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 10
|
retries: 10
|
||||||
|
|||||||
3
workspace-server/.gitignore
vendored
3
workspace-server/.gitignore
vendored
@ -1,2 +1,5 @@
|
|||||||
# The compiled binary, not the cmd/server package.
|
# The compiled binary, not the cmd/server package.
|
||||||
/server
|
/server
|
||||||
|
|
||||||
|
# air live-reload build cache (Dockerfile.dev + docker-compose.dev.yml).
|
||||||
|
/tmp/
|
||||||
|
|||||||
@ -31,7 +31,7 @@ RUN go mod download
|
|||||||
# block) so the Dockerfile doesn't need to COPY it. air watches the
|
# block) so the Dockerfile doesn't need to COPY it. air watches the
|
||||||
# bind-mounted dir for changes.
|
# bind-mounted dir for changes.
|
||||||
|
|
||||||
ENV CGO_ENABLED=1
|
ENV CGO_ENABLED=0
|
||||||
ENV GOFLAGS="-buildvcs=false"
|
ENV GOFLAGS="-buildvcs=false"
|
||||||
|
|
||||||
# Run air with the .air.toml in the bind-mounted source dir.
|
# Run air with the .air.toml in the bind-mounted source dir.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user