version: v1.0
name: Deploy to DockerHub
blocks:
  - name: Deploy to DockerHub
    task:
      jobs:
        - name: Deploy
          commands:
            - checkout
            - export TAG=$(echo ${SEMAPHORE_GIT_TAG_NAME:-vlatest} |cut -c 2-)
            - docker buildx create --platform=linux/amd64,linux/arm64 --use
            - 'docker buildx build --platform=linux/amd64,linux/arm64 --push -t "devicefarmer/stf:$TAG" .'
      secrets:
        - name: dockerhub-secrets
      prologue:
        commands:
          - 'echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin'
    dependencies: []
agent:
  machine:
    type: r1-standard-4
    os_image: ubuntu2204
