From 9e0cf5afc7ed9cf84947346fe168a35982893110 Mon Sep 17 00:00:00 2001 From: Yzakr Date: Tue, 26 Aug 2025 11:58:41 -0700 Subject: [PATCH 1/4] Adding github actions and docker files --- .dockerignore | 3 +++ .github/workflows/build.yaml | 31 +++++++++++++++++++++++++++++++ Dockerfile | 8 ++++++++ 3 files changed, 42 insertions(+) create mode 100644 .dockerignore create mode 100644 .github/workflows/build.yaml create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..469a95b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +*.webp +README.md +.git \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..a583224 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,31 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - main + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Extract Docker image metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ vars.DOCKER_USERNAME }}/facedetection + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + tags: ${{ steps.meta.outputs.tags }} + annotations: ${{ steps.meta.outputs.annotations }} + provenance: true + sbom: true \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6137e47 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM python:3.12-slim +WORKDIR /app +# TODO: Double copy for caching purpose +COPY . . +RUN pip install -r requirements.txt +EXPOSE 5001 +# TODO: USER change +CMD ["python", "main.py"] \ No newline at end of file From 32dca456ae2a11d2a45e26466dc622bb95a3478b Mon Sep 17 00:00:00 2001 From: Yzakr Date: Tue, 26 Aug 2025 12:11:01 -0700 Subject: [PATCH 2/4] add manual trigger --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a583224..da9ed5f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,7 +4,7 @@ on: push: branches: - main - pull_request: + workflow_dispatch: jobs: build: From ab16c1c08e80d769c457fa31c5c90d9dbfafb243 Mon Sep 17 00:00:00 2001 From: Yzakr Date: Tue, 26 Aug 2025 12:12:47 -0700 Subject: [PATCH 3/4] add ghaction trigger --- .github/workflows/build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index da9ed5f..2e9def6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,6 +4,7 @@ on: push: branches: - main + - github-action workflow_dispatch: jobs: From 37891d2ba1c6bf83d5d72406d3c57fedeed07a20 Mon Sep 17 00:00:00 2001 From: Yzakr Date: Tue, 26 Aug 2025 12:15:16 -0700 Subject: [PATCH 4/4] add ghaction trigger --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2e9def6..59790b7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -26,7 +26,7 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v6 with: - tags: ${{ steps.meta.outputs.tags }} + tags: latest annotations: ${{ steps.meta.outputs.annotations }} provenance: true sbom: true \ No newline at end of file