Can Vue Storefront 2 projects share a version-controlled Docker Compose setup for multiple backend integrations?
0 reputation · 14 Mar 2021, 06:43 UTC
0 reputation · 14 Mar 2021, 06:43 UTC
Establish a single, version-controlled development environment that works across Magento, Shopify, and other backend integrations without requiring each developer to maintain custom Docker overrides or local .env files.
The CLI-scaffolded docker-compose.yml only defines the frontend service and expects external API endpoints. The documentation recommends environment variables for backend configuration but does not provide a committed strategy for pinning backend versions, mock servers, or network topology. Community workarounds (docker-compose.override.yml, direnv, per-machine scripts) create drift and make onboarding inconsistent. The v1 integrated mock server was not carried forward, and there is no official GitHub Codespaces or Gitpod template to standardize cloud-based environments.
docker-compose.yml stay in sync with CLI updates so that dependency changes do not silently break the shared environment?34775 reputation · 14 Mar 2021, 12:24 UTC
Yes. A Vue Storefront 2 repository can share a version-controlled Docker Compose setup across Magento, Shopify, and local mock backends, but only if the shared configuration lives outside the CLI-generated base file. The official scaffold defines the frontend service and expects backend API endpoints to be supplied through environment variables; it does not natively manage backend containers, pinned versions, or seeded data.
Confirmed scaffold behavior: the generated docker-compose.yml is minimal and frontend-focused. Likely but version-dependent: the exact CLI command that produces it and the precise filename may differ across VSF2 releases and integration templates. Treat the generated file as disposable output, not source of truth.
Keep the generated base file untouched. Add a tracked companion file for backend services and an untracked override for machine-specific values.
# docker-compose.yml (generated, do not edit)
# docker-compose.backends.yml (tracked)
# docker-compose.override.yml (untracked, machine-local)In docker-compose.backends.yml, define optional services using Compose profiles:
services:
magento:
image: magento/magento2:latest
profiles: ["magento"]
# healthcheck and seed volumes here
shopify-mock:
image: your-shopify-mock:latest
profiles: ["shopify"]
# healthcheck and seed volumes hereBecause the base file has no profiles key, it starts by default. Backend services start only when their profile is requested.
Developers select a backend with the COMPOSE_PROFILES environment variable or the --profile flag:
COMPOSE_PROFILES=magento docker compose up
COMPOSE_PROFILES=shopify docker compose upMachine-specific tweaks—such as a local mock URL or an external host—belong in the untracked docker-compose.override.yml, which Compose merges automatically.
When the VSF2 CLI regenerates docker-compose.yml, any manual edits to that file are likely to be lost. To avoid drift:
docker-compose.backends.yml.docker-compose.override.yml and add it to .gitignore.No widely adopted official Gitpod or GitHub Codespaces template for a full VSF2 multi-backend stack is known. A minimal cloud setup is still feasible: add a .devcontainer/devcontainer.json or .gitpod.yml that installs the VSF2 dependencies, runs docker compose --profile <backend> up, and forwards the frontend port. Treat this as a community pattern to validate against your current VSF2 version rather than an official reference.
docker-compose.yml to confirm which services it defines.docker-compose.backends.yml with profiles and run docker compose --profile magento config and docker compose --profile shopify config to confirm isolation.docker-compose.yml; never hand-edit it.Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.