name: build-docker-image

on:
  workflow_dispatch:
  push:
    tags:
      - 'v*'

jobs:
  push_image:
      name: Push docker image to dockerhub
      runs-on: ubuntu-latest
      env:
        DATABASE_URL: "sqlite://./dim_dev.db"
      steps:
        - uses: actions/checkout@v2
        - run: docker login --username ${{ secrets.DOCKER_USERNAME }} --password ${{ secrets.DOCKER_PASSWORD }}
        - uses: dawidd6/action-get-tag@v1
        - run: docker build . -t vgarleanu/dim:${{steps.tag.outputs.tag}}
        - run: docker push vgarleanu/dim:${{steps.tag.outputs.tag}}
