From 82f54dc9fb2ba5bebb81132e67c5166614b46d6a Mon Sep 17 00:00:00 2001 From: anna Date: Wed, 7 Feb 2024 17:54:22 +0000 Subject: [PATCH] impl: ci --- .github/workflows/docker.yml | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..38a5f2d --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,47 @@ +name: docker +on: + - push + +jobs: + docker: + runs-on: ubuntu-22.04 + steps: + - run: curl -fsSL https://get.docker.com | sh + - uses: actions/checkout@v4 + - uses: docker/setup-buildx-action@v3 + - uses: actions/cache@v4 + id: cache + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + labels: | + cache-from=type=local,src=/tmp/.buildx-cache + cache-to=type=local,dest=/tmp/.buildx-cache + - uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - id: get_commit + run: echo ::set-output "name=hash::${GITHUB_SHA:0:7}" + - uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new + - run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache \ No newline at end of file