BitBucket
SSH Access
Pipelines
- BITBUCKET_BUILD_NUMBER
Template from BitBucket
# Template docker-push # This template allows you to build and push your docker image to a Docker Hub account. # The workflow allows running tests, code linting and security scans on feature branches (as well as master). # The docker image will be validated and pushed to the docker registry after the code is merged to master. # Prerequisites: $DOCKERHUB_USERNAME, $DOCKERHUB_PASSWORD setup as deployment variables image: atlassian/default-image:2 pipelines: default: - parallel: - step: name: Build and Test script: - IMAGE_NAME=$BITBUCKET_REPO_SLUG - docker build . --file Dockerfile --tag ${IMAGE_NAME} services: - docker caches: - docker - step: name: Lint the Dockerfile image: hadolint/hadolint:latest-debian script: - hadolint Dockerfile branches: master: - step: name: Build and Test script: - IMAGE_NAME=$BITBUCKET_REPO_SLUG - docker build . --file Dockerfile --tag ${IMAGE_NAME} - docker save ${IMAGE_NAME} --output "${IMAGE_NAME}.tar" services: - docker caches: - docker artifacts: - "*.tar" - step: name: Deploy to Production deployment: Production script: - echo ${DOCKERHUB_PASSWORD} | docker login --username "$DOCKERHUB_USERNAME" --password-stdin - IMAGE_NAME=$BITBUCKET_REPO_SLUG - docker load --input "${IMAGE_NAME}.tar" - VERSION="prod-0.1.${BITBUCKET_BUILD_NUMBER}" - IMAGE=${DOCKERHUB_NAMESPACE}/${IMAGE_NAME} - docker tag "${IMAGE_NAME}" "${IMAGE}:${VERSION}" - docker push "${IMAGE}:${VERSION}" services: - docker
Datamgmt attempt
# This is a sample build configuration for PHP. # Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples. # Only use spaces to indent your .yml configuration. # ----- # You can specify a custom docker image from Docker Hub as your build environment. image: php:7.4-fpm-buster pipelines: branches: release/*: - step: caches: - composer script: - apt-get update && apt-get install -y unzip zip - apt-get install --assume-yes git libgmp10 libgmp-dev libicu63 libicu-dev libpq-dev libpq5 libzip-dev libzip4 zlib1g-dev zlib1g - docker-php-source extract - docker-php-ext-install --jobs $(nproc) gmp intl opcache pdo_pgsql zip - docker-php-source delete - apt-get purge --assume-yes libgmp-dev libicu-dev libpq-dev libzip-dev zlib1g-dev - apt-get autoremove --purge --assume-yes - curl --silent --show-error --fail --location --retry 3 --output /tmp/installer.php --url https://getcomposer.org/installer - echo "$(curl --silent --show-error --fail --location --retry 3 --url https://composer.github.io/installer.sig) /tmp/installer.php" | sha384sum --check - php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer --version="1.10.6" - composer --ansi --version --no-interaction - COMPOSER_MEMORY_LIMIT=-1 composer install --ignore-platform-reqs # - COMPOSER_MEMORY_LIMIT=-1 composer update - vendor/bin/phpunit services: - postgres definitions: services: postgres: image: postgres variables: POSTGRES_DB: nmpf POSTGRES_USER: postgres POSTGRES_PASSWORD: password
Self Hosted bitbucket pipeline runner
runner: container_name: runner-3c285435x37e460c6da image: docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-runner:1 volumes: - /tmp:/tmp - /var/run/docker.sock:/var/run/docker.sock - /var/lib/docker/containers:/var/lib/docker/containers:ro environment: - ACCOUNT_UUID={d38c9701-69ec-4edd-8166-3f239e3b657c} - RUNNER_UUID={3c285435-411b-581a-9378-df37e460c6da} - RUNTIME_PREREQUISITES_ENABLED=true - OAUTH_CLIENT_ID=rwQcBswnx9jtl6qS6 - OAUTH_CLIENT_SECRET=SSADSzRs5EE_Kofv0xVwW4aUIRuxIzjDmzI_En - WORKING_DIRECTORY=/tmp