name: docker antithesis

on:
    push:
        branches:
            - unstable

env:
    ANTITHESIS_PASSWORD: ${{ secrets.ANTITHESIS_PASSWORD }}
    ANTITHESIS_USERNAME: ${{ secrets.ANTITHESIS_USERNAME }}
    ANTITHESIS_SERVER: ${{ secrets.ANTITHESIS_SERVER }}
    REPOSITORY: ${{ secrets.ANTITHESIS_REPOSITORY }}
    IMAGE_NAME: lighthouse
    TAG: libvoidstar

jobs:
    build-docker:
        runs-on: ubuntu-22.04
        steps:
            - uses: actions/checkout@v3
            - name: Update Rust
              run: rustup update stable
            - name: Dockerhub login
              run: |
                  echo "${ANTITHESIS_PASSWORD}" | docker login --username ${ANTITHESIS_USERNAME} https://${ANTITHESIS_SERVER} --password-stdin
            - name: Build AMD64 dockerfile (with push)
              run: |
                  docker build \
                      --tag ${ANTITHESIS_SERVER}/${REPOSITORY}/${IMAGE_NAME}:${TAG} \
                      --file ./testing/antithesis/Dockerfile.libvoidstar .
                  docker push ${ANTITHESIS_SERVER}/${REPOSITORY}/${IMAGE_NAME}:${TAG}
