diff --git a/.github/workflows/container-upload.yml b/.github/workflows/container-upload.yml new file mode 100644 index 000000000..c1c16ff1d --- /dev/null +++ b/.github/workflows/container-upload.yml @@ -0,0 +1,61 @@ +name: Build and Upload Container + +on: + # Manual trigger capability + workflow_dispatch: + + # Trigger when Dockerfile is changed + push: + branches: + - master + paths: + - 'Dockerfile' + + # Also build on PRs to test Dockerfile changes + pull_request: + paths: + - 'Dockerfile' + +jobs: + build-and-push: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + # Only login when pushing (on master branch) + if: github.ref == 'refs/heads/master' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=sha,prefix={{branch}}-,enable={{is_default_branch}} + type=sha + type=raw,value=latest,enable={{is_default_branch}} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + # Only push to registry on master branch, otherwise just build + push: ${{ github.ref == 'refs/heads/master' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + +# vim:set sts=2: diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..e18bcc4ec --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM alpine:latest + +# Create a timestamp file to make each build unique +RUN echo "Built at: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" > /timestamp.txt && \ + cat /timestamp.txt + +# Add a simple healthcheck script +RUN echo '#!/bin/sh' > /healthcheck.sh && \ + echo 'cat /timestamp.txt' >> /healthcheck.sh && \ + chmod +x /healthcheck.sh + +CMD ["/healthcheck.sh"]