Skip to content

[ci] Remove .git directory from .dockerignore #68

[ci] Remove .git directory from .dockerignore

[ci] Remove .git directory from .dockerignore #68

Workflow file for this run

name: CI Publish rocky9-fs
on:
push:
branches: [ "main" ]
tags:
- '*'
pull_request:
branches: [ "main" ]
env:
BUILD_TYPE: Release
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Record event type
run: |
branchName=$(echo "${{ github.ref_name }}")
echo "BRANCH_NAME=$branchName" >> $GITHUB_ENV
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "EVENT_TYPE=PR" >> $GITHUB_ENV
echo "Skipping build steps for pull request event"
elif [ "${{ github.event_name }}" == "push" ]; then
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
echo "EVENT_TYPE=TAG" >> $GITHUB_ENV
tagInfo=$(echo "${{ github.ref }}" | sed 's/refs\/tags\///')
if [ -n "$tagInfo" ]; then
echo "TAG_NAME=$tagInfo" >> $GITHUB_ENV
fi
else
echo "EVENT_TYPE=PUSH" >> $GITHUB_ENV
fi
fi
- name: Copy dingo-eureka repository
if: ${{ github.event_name == 'push'}}
run: |
echo "Move dingo-eureka repository"
sudo cp -r /home/runner/work/dingo-eureka/dingo-eureka /mnt/
sudo chown -R $USER:$USER /mnt/dingo-eureka
- name: Set Safe Dir
if: ${{ github.event_name == 'push'}}
run: git config --global --add safe.directory /mnt/dingo-eureka
- name: Configure Docker data-root
if: ${{ github.event_name == 'push'}}
run: |
sudo systemctl stop docker
sudo systemctl stop docker.socket
sudo mkdir -p /mnt/docker
echo '{ "data-root": "/mnt/docker" }' | sudo tee /etc/docker/daemon.json
if [ -d /var/lib/docker ]; then
sudo mv /var/lib/docker /mnt/docker || true
fi
sudo systemctl start docker.socket
sudo systemctl start docker
docker info | grep "Docker Root Dir"
- name: Sync submodules
if: ${{ github.event_name == 'push'}}
run: |
cd /mnt/dingo-eureka
git submodule sync --recursive
git submodule update --init --recursive
- name: Clean .git directory
if: ${{ github.event_name == 'push'}}
run: |
find /mnt/dingo-eureka -name ".git" -type d -exec rm -rf {} +
- name: Pull dingo-base:rocky9
if: ${{ github.event_name == 'push'}}
run: |
docker pull dingodatabase/dingo-base:rocky9
- name: Set up Docker Buildx
if: ${{ github.event_name == 'push'}}
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: ${{ github.event_name == 'push'}}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta of rocky9-fs
if: ${{ github.event_name == 'push'}}
id: rocky9-fs-meta
uses: docker/metadata-action@v5
with:
images: dingodatabase/dingo-eureka
tags: |
type=raw,value=rocky9-fs,enable=${{ env.EVENT_TYPE != 'tag' && github.ref_name == 'main' }}
type=raw,value=rocky9-fs-${{ env.TAG_NAME }},enable=${{ env.EVENT_TYPE == 'tag' }}
type=sha,prefix=rocky9-fs-,format=short,enable=${{ github.ref_name == 'main' && env.EVENT_TYPE != 'tag' }}
type=sha,prefix=rocky9-fs-${{ github.ref_name }}-,format=short,enable=${{ env.EVENT_TYPE != 'tag' && github.ref_name != 'main' }}
- name: Build and push 'dingo-eureka:rocky9-fs'
if: ${{ github.event_name == 'push'}}
uses: docker/build-push-action@v6
with:
context: /mnt/dingo-eureka
file: /mnt/dingo-eureka/docker/eureka/rocky9/Dockerfile-fs
push: true
tags: ${{ steps.rocky9-fs-meta.outputs.tags }}