Skip to content

FriendsOfShopware/shopware-demo-environment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shopware Demo Environment

This repository contains a Docker image to run a Shopware 6 environment. It is based on the official Shopware 6 Docker image and adds some demo data to the database.

Usage

To start the Shopware 6 environment, run the following command:

docker run \
    --rm \
    # External reachable URL, aka sales channel URL in shopware
    -e APP_URL=http://localhost:8000 \
    -p 8000:8000 \
    ghcr.io/friendsofshopware/shopware-demo-environment:6.5.8

See here for all available images

You can additionally set SHOPWARE_ADMIN_PASSWORD to set a different admin password.

To install Shopware 6 extensions you will need to set the EXTENSIONS environment variable. This variable should be a space separated list of composer packages. For example:

docker run \
    --rm \
    -e APP_URL=http://localhost:8000 \
    -e EXTENSIONS="frosh/tools" \
    -p 8000:8000 \
    ghcr.io/friendsofshopware/shopware-demo-environment:6.5.8

For Shopware Store plugins, you need to pass the SHOPWARE_PACKAGIST_TOKEN environment variable generated from a Wildcard environment.

Example:

docker run \
    --rm \
    -e APP_URL=http://localhost:8000 \
    -e EXTENSIONS="store.shopware.com/froshtools store.shopware.com/froshplatformsharebasket" \
    -e SHOPWARE_PACKAGIST_TOKEN=your-token \
    -p 8000:8000 \
    ghcr.io/friendsofshopware/shopware-demo-environment:6.5.8

Running multiple containers

If you want to run multiple containers, you should deploy a Traefik before the containers. This will allow you to access the containers via different subdomains.

See as an example the compose.yml file

Custom Fixtures

You can inject a fixture.php to /var/www/html to run custom commands on the Shopware DI container to populate the database with custom data.

Example:

docker run \
    --rm \
    -e APP_URL=http://localhost:8000 \
    -e EXTENSIONS="frosh/tools" \
    -v $(pwd)/fixture.php:/var/www/html/fixture.php \
    -p 8000:8000 \
    ghcr.io/friendsofshopware/shopware-demo-environment:6.5.8
<?php

$kernel = require '/opt/shopware/boot.php';

var_dump($kernel->getContainer()->get('product.repository')->getDefinition()->getEntityName());

This script is executed at any container start, so you can use it to populate the database with custom data. All DI services are available in this script.

Thanks to Namespace.so

Thanks to namespace.so for sponsoring their fast Docker builder with multi arch support. Checkout namespace.so if you need better GitHub runners or Docker remote builders.