Skip to content

reset

reset #65

name: Build and Publish Docker Image on Tag
on:
push:
branches:
- '**' # match all branches
tags-ignore:
- '**'
jobs:
build:
runs-on: ubuntu-latest
steps:
# Step 1: Set up Docker Buildx (supports layer caching)
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Step 2: Restore cache for Docker layers
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: buildx-cache-${{ github.sha }}
restore-keys: |
buildx-cache-${{ github.sha }}
buildx-cache-
buildx
# Step 3: Check out the repository
- name: Checkout repository
uses: actions/checkout@v4
# # Step 4: Log in to registry
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Initialize cache directory
run: mkdir -p /tmp/.buildx-cache
- name: Debug cache
run: ls -l /tmp/.buildx-cache
# Step 5: Build and push the Docker image with caching
- name: Build and Push standard Docker image
run: |
docker buildx build \
--cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache,mode=max \
--tag ghcr.io/ximeraproject/ximeralatex:latest \
--file docker/Dockerfile.full \
--push .
# - name: Build and Push full Docker image
# run: |
# docker buildx build \
# --cache-from=type=local,src=/tmp/.buildx-cache \
# --cache-to=type=local,dest=/tmp/.buildx-cache,mode=max \
# --tag ghcr.io/ximeraproject/ximeralatex:${{ github.ref_name }}-full \
# --file docker/Dockerfile.full \
# --push .
# - name: Debug cache
# run: ls -l /tmp/.buildx-cache
# - name: Save cache
# uses: actions/cache@v4
# with:
# path: /tmp/.buildx-cache
# key: buildx-cache-${{ github.sha }}-saved