# This is a sample build configuration for Docker.
# Check our guides at https://confluence.atlassian.com/x/O1toN 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: atlassian/default-image:2

pipelines:
  default:
    - step:
        services:
          - docker
        script: # Modify the commands below to build your repository.
          # Set $DOCKER_HUB_USERNAME and $DOCKER_HUB_PASSWORD as environment variables in repository settings $BITBUCKET_COMMIT
          - export IMAGE_NAME=bgarage/bgadmin:v1.0

          # build the Docker image (this will use the Dockerfile in the root of the repo)
          - docker build -t $IMAGE_NAME .
          # authenticate with the Docker Hub registry
          - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
          # push the new Docker image to the Docker registry
          - docker push $IMAGE_NAME



          #- mkdir -p ~/.ssh
          #- cat my_known_hosts >> ~/.ssh/known_hosts
          #- (umask  077 ; echo $MY_SSH_KEY | base64 --decode > ~/.ssh/id_rsa)
          #- ssh lafeela@maru.bgarage.ai '/home/lafeela/updateServer_admin_v1.0.sh $DOCKER_HUB_USERNAME $DOCKER_HUB_PASSWORD'
          
          # bash backend 
          - bash ./script/pro_backend.sh $DOCKER_HUB_USERNAME $DOCKER_HUB_PASSWORD
