|
| 1 | +name: Docker Demo Build & Push |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + - '[0-9]+.[0-9]+.[0-9]+' |
| 8 | + |
| 9 | +env: |
| 10 | + REGISTRY: ghcr.io |
| 11 | + IMAGE_NAME: ${{ github.repository }}-demo |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + permissions: |
| 17 | + contents: write |
| 18 | + packages: write |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout repository |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Set up Docker Buildx |
| 25 | + uses: docker/setup-buildx-action@v3 |
| 26 | + |
| 27 | + - name: Log in to GHCR |
| 28 | + if: github.event_name != 'pull_request' |
| 29 | + uses: docker/login-action@v3 |
| 30 | + with: |
| 31 | + registry: ${{ env.REGISTRY }} |
| 32 | + username: ${{ github.actor }} |
| 33 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 34 | + |
| 35 | + - name: Extract metadata (tags, labels) |
| 36 | + id: meta |
| 37 | + uses: docker/metadata-action@v5 |
| 38 | + with: |
| 39 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 40 | + tags: | |
| 41 | + type=ref,event=tag |
| 42 | + type=semver,pattern={{version}} |
| 43 | + type=semver,pattern={{major}}.{{minor}} |
| 44 | + type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }} |
| 45 | +
|
| 46 | + - name: Build and push Docker demo image |
| 47 | + uses: docker/build-push-action@v5 |
| 48 | + with: |
| 49 | + context: . |
| 50 | + file: ./Dockerfile-demo |
| 51 | + push: ${{ github.event_name != 'pull_request' }} |
| 52 | + tags: ${{ steps.meta.outputs.tags }} |
| 53 | + labels: ${{ steps.meta.outputs.labels }} |
| 54 | + cache-from: type=gha |
| 55 | + cache-to: type=gha,mode=max |
| 56 | + |
| 57 | + - name: Update GitHub Release with Demo Info |
| 58 | + if: startsWith(github.ref, 'refs/tags/v') |
| 59 | + uses: softprops/action-gh-release@v1 |
| 60 | + with: |
| 61 | + append_body: true |
| 62 | + body: | |
| 63 | + |
| 64 | + ## 🎮 Demo Docker Image |
| 65 | + |
| 66 | + Try the pre-configured demo with sample data: |
| 67 | + |
| 68 | + ```bash |
| 69 | + # Pull the demo image |
| 70 | + docker pull ghcr.io/gcclinux/easyscheduler-demo:latest |
| 71 | + # or |
| 72 | + docker pull ghcr.io/gcclinux/easyscheduler-demo:${{ github.ref_name }} |
| 73 | + |
| 74 | + # Run the demo container |
| 75 | + docker run --name "easyscheduler-demo" -d -p 80:5001 ghcr.io/gcclinux/easyscheduler-demo:latest |
| 76 | + ``` |
| 77 | + |
| 78 | + **Demo Features:** |
| 79 | + - 🔒 Read-only demo user (login: `demo`, password: `demo`) |
| 80 | + - 👥 5 pre-seeded users |
| 81 | + - 📅 8 sample appointments |
| 82 | + - 🎨 Green theme |
| 83 | + - 🚫 No database modifications allowed |
| 84 | + |
| 85 | + Access at: **http://localhost** |
| 86 | + env: |
| 87 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments