From 96fb7040c1ce3b69853f6c1b62e4d2d520cddd14 Mon Sep 17 00:00:00 2001 From: Nolan Poe Date: Sun, 11 Dec 2022 20:54:25 +0000 Subject: [PATCH] add .github/workflows/docker-image.yml: - Builds amd64/arm64 images - Uploads those images to docker hub with latest and date tags - Automatically runs once a week - Credentials are stored in GitHub secrets --- .github/workflows/docker-image.yml | 45 ++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..9fc7b1c --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,45 @@ +name: Docker Image CI + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + schedule: + - cron: "30 12 * * 0" # Run once every Sunday + +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ secrets.DOCKER_USERNAME }}/ultraviolet-node + tags: | + type=raw,value={{date 'YYYYMMDD'}} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build & push Docker image + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ secrets.DOCKER_USERNAME }}/ultraviolet-node:latest,${{ steps.meta.outputs.tags }}