From 5606f9b4ade1f2c6105a0598df27bd4ad2bee645 Mon Sep 17 00:00:00 2001 From: SoftwareRat <40393784+SoftwareRat@users.noreply.github.com> Date: Sun, 8 Sep 2024 22:14:48 +0200 Subject: [PATCH] - Docker: Auto-build for Docker Hub --- .github/workflows/docker.yaml | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/docker.yaml diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml new file mode 100644 index 0000000..d8179ec --- /dev/null +++ b/.github/workflows/docker.yaml @@ -0,0 +1,42 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - main + paths: + - 'Dockerfile' + - '**/Dockerfile' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Cache Docker layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Build Docker image + run: | + docker build --tag ${{ secrets.DOCKER_HUB_USERNAME }}/pppwn_live:latest . + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Push Docker image + run: | + docker push ${{ secrets.DOCKER_HUB_USERNAME }}/pppwn_live:latest \ No newline at end of file