Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/container-upload.yml
Original file line number Diff line number Diff line change
@@ -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:
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]