Add automated Docker Hub publishing workflow
- Add GitHub Actions workflow for building and publishing Docker images - Trigger on version tags (v*) to publish to Docker Hub - Update README with Docker Hub deployment instructions
This commit is contained in:
35
.github/workflows/docker-publish.yml
vendored
Normal file
35
.github/workflows/docker-publish.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: Build and Push Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*' # triggers only on version tags like v1.0.0, v25.04, etc.
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract version from tag
|
||||||
|
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Build and push Docker image with two tags
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
mattintech/kcapdemoserver:latest
|
||||||
|
mattintech/kcapdemoserver:${{ env.VERSION }}
|
||||||
43
README.md
43
README.md
@@ -36,13 +36,36 @@ This project is a simple Flask API for demonstrating AR content retrieval for ba
|
|||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
### Option 1: Docker (Recommended)
|
### Option 1: Docker Hub (Recommended)
|
||||||
|
|
||||||
|
Pull and run the pre-built image from Docker Hub:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Pull the latest image
|
||||||
|
docker pull mattintech/kcapdemoserver:latest
|
||||||
|
|
||||||
|
# Run the container
|
||||||
|
docker run -p 5555:5000 \
|
||||||
|
-e SECRET_KEY=your-secret-key-here \
|
||||||
|
-e DATABASE_URL=sqlite:///data/kcap_demo.db \
|
||||||
|
-v $(pwd)/data:/app/data \
|
||||||
|
mattintech/kcapdemoserver:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
Or use a specific version:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker pull mattintech/kcapdemoserver:v1.0.0
|
||||||
|
docker run -p 5555:5000 --env-file .env mattintech/kcapdemoserver:v1.0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
### Option 2: Docker Compose
|
||||||
|
|
||||||
1. **Clone the Repository:**
|
1. **Clone the Repository:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone <repository_url>
|
git clone https://github.com/mattintech/KCAPDemoServer.git
|
||||||
cd <repository_folder>
|
cd KCAPDemoServer
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Configure Environment:**
|
2. **Configure Environment:**
|
||||||
@@ -75,7 +98,7 @@ docker-compose logs -f
|
|||||||
docker-compose down
|
docker-compose down
|
||||||
```
|
```
|
||||||
|
|
||||||
### Option 2: Local Python Setup
|
### Option 3: Local Python Setup
|
||||||
|
|
||||||
1. **Clone the Repository:**
|
1. **Clone the Repository:**
|
||||||
|
|
||||||
@@ -149,6 +172,18 @@ The following barcode types are available:
|
|||||||
└── generate_barcode.html # Barcode generation page
|
└── generate_barcode.html # Barcode generation page
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Docker Hub
|
||||||
|
|
||||||
|
Pre-built Docker images are automatically published to Docker Hub on each release:
|
||||||
|
|
||||||
|
**Repository**: [mattintech/kcapdemoserver](https://hub.docker.com/r/mattintech/kcapdemoserver)
|
||||||
|
|
||||||
|
**Available Tags**:
|
||||||
|
- `latest` - Most recent release
|
||||||
|
- `v1.0.0`, `v1.0.1`, etc. - Specific version releases
|
||||||
|
|
||||||
|
For maintainers: See [DOCKER_HUB_SETUP.md](DOCKER_HUB_SETUP.md) for information on configuring automated builds.
|
||||||
|
|
||||||
## Implementation Notes
|
## Implementation Notes
|
||||||
|
|
||||||
* The application is designed as a single server hosting both the API endpoints and admin interface.
|
* The application is designed as a single server hosting both the API endpoints and admin interface.
|
||||||
|
|||||||
Reference in New Issue
Block a user