Skip to content

XCO-Agency/shopify-docker-lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Shopify Docker Development Environment

This repository provides a flexible Docker environment for developing Shopify apps, themes, and using the Shopify CLI. It is suitable for any developer and any Shopify project.

Features

  • Node.js (LTS) for app development
  • Ruby (latest stable) for theme development and Shopify CLI
  • Shopify CLI (latest)
  • Yarn, npm, pnpm
  • Git, zsh, build tools
  • Locale: en_US.UTF-8

Getting Started

1. Build the Docker Image

docker-compose build

2. Start the Development Container

docker-compose up -d

3. Access the Container Shell

docker exec -it shopify-dev zsh

Your project files are mounted at /workspace inside the container.

Usage Examples

Shopify App Development

  • Run your app as usual (e.g., npm run dev or shopify app dev).
  • Port 3000 is exposed for local development.

Shopify Theme Development

  • Use Shopify CLI commands, e.g.:
    shopify theme serve
  • Port 9292 is exposed for theme preview.

Shopify CLI

  • All CLI commands are available:
    shopify version
    shopify login
    shopify app create node
    shopify theme pull

Customization

  • You can add more dependencies by editing the Dockerfile.
  • Mount other directories as needed by editing docker-compose.yml.

Notes

  • Make sure you have Docker and Docker Compose installed.
  • For Shopify login, use device authentication in the CLI (browser-based login works from inside the container).

Shopify CLI Login

When you run shopify login or any command that requires authentication, the CLI will print a device code and a login link. Simply copy the link and open it in your host machine's browser. After you complete authentication, the CLI in the container will detect the login automatically.

Note:

  • If you see an error like Error: spawn xdg-open ENOENT, it just means the CLI couldn't open a browser inside the container. This is harmless—just copy the link and open it manually.
  • You do NOT need XQuartz, X11, or a browser inside the container for Shopify CLI login.

Quick Start with the Shopify Dev Bash Script

This project includes a helper script (shopify-dev) that makes working with the Docker environment easy and fast.

1. Make the Script Executable

chmod +x shopify-dev

2. Usage

Run the script with one of the following commands:

./shopify-dev up        # Start the Docker container
./shopify-dev down      # Stop the Docker container
./shopify-dev shell     # Enter a shell (zsh) inside the container
./shopify-dev app       # Run Shopify app (pnpm dev) in the container
./shopify-dev theme     # Run Shopify theme serve in the container
./shopify-dev logs      # Show container logs

3. Typical Workflow

  1. Start the container:
    ./shopify-dev up
  2. Enter the container shell:
    ./shopify-dev shell
  3. Run your Shopify app or theme commands as needed.
  4. When finished, stop the container:
    ./shopify-dev down

4. Notes

  • All your project files are available at /workspace inside the container.
  • You can use pnpm, npm, yarn, shopify, and all other tools inside the shell.
  • The script makes it easy for any developer to get started without memorizing Docker commands.

Happy Shopify hacking!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors