Starting from Scratch
Start a new Magento project with the devcontainer when you don't have an existing codebase.
Prerequisites
- VS Code with the Dev Containers extension
- Docker
Steps
- Create a project directory and add the devcontainer:
bash
mkdir my-magento-store && cd my-magento-store
mkdir -p .devcontainer
git submodule add https://github.com/graycoreio/magento2-devcontainer.git .devcontainer/magento2-devcontainer- Run the init script and select your desired Magento version:
bash
.devcontainer/magento2-devcontainer/bin/init.shOpen in VS Code and click Reopen in Container when prompted.
Create the Magento project inside the container:
bash
composer create-project \
--repository-url=https://mirror.mage-os.org/ \
magento/project-community-edition /tmp/magento
cp -r /tmp/magento/. /workspace/
rm -rf /tmp/magento- Run setup:
bash
.devcontainer/magento2-devcontainer/bin/setup-install.sh | bash- Verify the installation:
bash
bin/magento --versionNext Steps
- Docker Compose Configuration - Customize your environment
- TLS Setup - Enable HTTPS for local development