build the docker image and push a new one to kithub
This commit is contained in:
parent
7959c50e55
commit
18239aa0ae
@ -1,19 +0,0 @@
|
|||||||
name: Gitea Actions Demo
|
|
||||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
Explore-Gitea-Actions:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
|
||||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
|
||||||
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
|
||||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
|
||||||
- name: List files in the repository
|
|
||||||
run: |
|
|
||||||
ls ${{ gitea.workspace }}
|
|
||||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
|
47
.gitea/workflows/docker-publish.sh
Normal file
47
.gitea/workflows/docker-publish.sh
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
name: Build and Publish Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
tags: ['*'] # triggers on any tag push
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
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 Registry
|
||||||
|
run: echo "${{ secrets.PASSWORD }}" | docker login ${{ secrets.REGISTRY }} -u "${{ secrets.USERNAME }}" --password-stdin
|
||||||
|
|
||||||
|
- name: Build and Push Docker Images
|
||||||
|
run: |
|
||||||
|
IMAGE_NAME="ktv-ui"
|
||||||
|
REGISTRY="${{ secrets.REGISTRY }}"
|
||||||
|
USERNAME="${{ secrets.USERNAME }}"
|
||||||
|
IMAGE_LATEST="$REGISTRY/$USERNAME/$IMAGE_NAME:latest"
|
||||||
|
|
||||||
|
# Always build and tag as latest
|
||||||
|
echo "🔧 Building $IMAGE_LATEST"
|
||||||
|
docker build -t $IMAGE_LATEST .
|
||||||
|
|
||||||
|
echo "📤 Pushing $IMAGE_LATEST"
|
||||||
|
docker push $IMAGE_LATEST
|
||||||
|
|
||||||
|
# If this is a tag push, tag the image accordingly
|
||||||
|
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
|
||||||
|
GIT_TAG="${GITHUB_REF#refs/tags/}"
|
||||||
|
IMAGE_TAGGED="$REGISTRY/$USERNAME/$IMAGE_NAME:$GIT_TAG"
|
||||||
|
|
||||||
|
echo "🏷️ Also tagging as $IMAGE_TAGGED"
|
||||||
|
docker tag $IMAGE_LATEST $IMAGE_TAGGED
|
||||||
|
|
||||||
|
echo "📤 Pushing $IMAGE_TAGGED"
|
||||||
|
docker push $IMAGE_TAGGED
|
||||||
|
fi
|
22
dockerfile
Normal file
22
dockerfile
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
FROM python:3.11-slim
|
||||||
|
|
||||||
|
# Install system dependencies required by PaddleOCR and OpenCV
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
libglib2.0-0 \
|
||||||
|
libsm6 \
|
||||||
|
libxrender1 \
|
||||||
|
libxext6 \
|
||||||
|
libgomp1 \
|
||||||
|
libgl1 \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
EXPOSE 8089
|
||||||
|
|
||||||
|
CMD ["python", "app.py"]
|
Loading…
x
Reference in New Issue
Block a user