> For the complete documentation index, see [llms.txt](https://docs.dockware.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dockware.io/tutorials/ci-cd-tutorials/bitbucket.md).

# Bitbucket

This page should give you instructions and some ideas on how to use dockware images in Bitbucket workflows and pipelines.

Please keep in mind, these might not always be 100% accurate samples, because some things like installing dependencies and so on, might work different in your project. In fact, some of these things are only related to projects, but you should get the idea.

{% hint style="info" %}
Are we missing something? Just let us know and we'd be happy to add it here!
{% endhint %}

## Pipeline image vs. Steps with containers

You have 2 different options to use dockware (or any other image) within a Bitbucket pipeline.

You can either run your **full pipeline inside a dockware image**, or use dockware as a **standalone container** that hosts your Shopware (or other app) just like you would do it locally.

When do you need what? That is totally up to you, but we still have a few words on that.

Let's assume there are different commands, next to each other, that you usually also do within your container while developing your system. It would indeed make sense to just use a single image for your pipeline, and run all your commands in it. That just feels...tight..right?

On the other hand, as soon as you start to interact with your system from an "external point of view"...maybe with Cypress, then it would indeed make more sense, to launch a new container within your steps. You can even mount your source code into your container by using this variable **$BITBUCKET\_CLONE\_DIR.**

Here are short snippets for both ways.

### Pipeline Image

```yaml
image: dockware/web:latest

pipelines:
  default:
    - step:
        name: PHPUnit
        script:
          - composer install
          - php vendor/bin/phpunit --configuration phpunit.xml
```

### Containers in Pipeline

```yaml
clone:
  depth: 1
options:
  max-time: 10

pipelines:
  default:
    - step:
        name: Check Code
        services:
          - docker
        caches:
          - docker
        script:
          - docker run --rm -p 80:80 --name=shopware -e PHP_VERSION=8.1 -v $BITBUCKET_CLONE_DIR:/var/www/html -d dockware/web:latest
          - docker exec shopware bash -c 'make dev'
          - docker exec shopware bash -c 'make phpunit -B'
          - docker exec shopware bash -c 'make stan -B'
```

{% hint style="info" %}
Please keep in mind, the samples below work with both ways. But we cannot always show both of them! Please consider this!
{% endhint %}

## Building and Testing

Dockware has been built to have everything on board that you need for a smooth Shopware developer experience.

You can of course use those images in your build pipeline for whatever task you need to do. This can range from simple dependency installation, on to building of storefront and administration as well as unit testing, execution of static analyzers and more. Everything you usually need should be already installed (of course no project dependent dependencies and tools haha).

To use dockware for your actions, just add a new step and provide any of the available dockware images. Then within your scripts, do whatever you want :)

```yaml
image: dockware/web:latest

clone:
  depth: 1
options:
  max-time: 10

pipelines:
  default:
    - step:
        name: PHPUnit
        caches:
          - dockware-composer
          - node
        script:
          - composer install
          - php vendor/bin/phpunit --configuration phpunit.xml.dist

definitions:
  caches:
    dockware-composer: /var/www/.cache/composer
    node: /var/www/.npm    
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.dockware.io/tutorials/ci-cd-tutorials/bitbucket.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
