Docker Build #567
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Build | |
on: | |
# Allows manual run of this workflow from the Actions tab (on any branch) | |
workflow_dispatch: | |
# For debugging | |
# on: | |
# push: | |
# branches: '' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the Code | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Docker Diagnostics | |
run: | | |
docker system df | |
- name: Host System Diagnostics | |
run: | | |
df -h | |
du -sh * | |
- name: Docker Cleanup | |
run: | | |
docker system prune -af | |
docker volume prune -f | |
docker builder prune -f | |
- name: Builder Bootstrap | |
run: docker buildx create --name devBuilder --use --bootstrap | |
- name: Build the Docker Image | |
run: docker buildx build -t swirlai/swirl-search:develop --platform linux/amd64,linux/arm64 --push . | |
- name: Update the Docker Repo Description | |
uses: peter-evans/dockerhub-description@v4 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME_X }} | |
password: ${{ secrets.DOCKER_PASSWORD_X }} | |
repository: swirlai/swirl-search | |
- name: Create Artifacts Directory | |
run: mkdir -p artifacts | |
- name: Set Branch Name | |
id: extract_branch | |
run: | | |
BRANCH_NAME=$(echo $GITHUB_REF | cut -d "/" -f 3) | |
echo "branch=$BRANCH_NAME" >> $GITHUB_ENV | |
- name: Write Branch and run_id to File | |
run: | | |
echo "${{ env.branch }}" > ./artifacts/branch.txt | |
echo "${{ github.run_id }}" > ./artifacts/run_id.txt | |
- name: Upload Branch and run_id Files as Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: branch-info-${{ github.run_id }} | |
path: | | |
./artifacts/branch.txt | |
./artifacts/run_id.txt | |
- name: Upload Log Files | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: log-files | |
path: | | |
logs/ | |
/var/log/syslog* |