name: Docker nightly build

on:
  schedule:
    - cron: '0 1 * * *'

jobs:
  build_image:
    name: Build nodejs-rust:lts-alpine
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Setup QEMU
        uses: docker/setup-qemu-action@v1

      - name: Setup Docker Buildx
        uses: docker/setup-buildx-action@v1

      - name: Login to GitHub Container Registry
        uses: docker/login-action@v1
        with:
          registry: ghcr.io
          username: ${{ secrets.GH_CONTAINER_UNAME }}
          password: ${{ secrets.GH_TOKEN }}

      - name: Build and push alpine
        uses: docker/build-push-action@v2
        with:
          file: alpine.Dockerfile
          platforms: linux/amd64,linux/arm64
          push: true
          tags: ghcr.io/${{ github.repository }}/nodejs-rust:lts-alpine

      - name: Build and push debian
        uses: docker/build-push-action@v2
        with:
          file: debian.Dockerfile
          platforms: linux/amd64,linux/arm64
          push: true
          tags: ghcr.io/${{ github.repository }}/nodejs-rust:lts-debian