-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit eda00c9
Showing
3 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# .github/workflows/build-and-push.yml | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- 'v*.*.*' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract version | ||
id: vars | ||
run: | | ||
if [ "${GITHUB_REF_TYPE}" == "tag" ]; then | ||
VERSION=${GITHUB_REF_NAME#refs/tags/v} | ||
else | ||
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0") | ||
fi | ||
echo "VERSION=${VERSION}" >> $GITHUB_ENV | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
ghcr.io/heavybullets8/zfs-scrubber:latest | ||
ghcr.io/heavybullets8/zfs-scrubber:${{ env.VERSION }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Dockerfile | ||
FROM alpine:3.20 | ||
|
||
# Install ZFS utilities | ||
RUN apk add --no-cache zfs | ||
|
||
# Copy the entrypoint script | ||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
# Make the script executable | ||
RUN chmod +x /entrypoint.sh | ||
|
||
# Set the entrypoint | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
|
||
# entrypoint.sh | ||
set -e | ||
|
||
if [ -z "$ZFS_POOL" ]; then | ||
echo "Error: No ZFS_POOL specified. Exiting." | ||
exit 1 | ||
fi | ||
|
||
echo "Starting scrub on pool: $ZFS_POOL" | ||
|
||
if zpool scrub -w "$ZFS_POOL"; then | ||
echo "Scrub failed on pool: $ZFS_POOL" | ||
exit 1 | ||
fi | ||
|
||
echo "Scrub completed on pool: $ZFS_POOL" |