cevheri commited on
Commit
50c4cd0
·
1 Parent(s): ec15acd

build: docker build with github actions

Browse files
.github/workflows/build.yaml CHANGED
@@ -4,7 +4,7 @@ name: Build dependencies
4
 
5
  on:
6
  push:
7
- branches: [ build ]
8
 
9
  jobs:
10
  build:
@@ -26,5 +26,3 @@ jobs:
26
 
27
  - uses: astral-sh/ruff-action@v3
28
  - run: ruff check
29
-
30
-
 
4
 
5
  on:
6
  push:
7
+ branches: [ main ]
8
 
9
  jobs:
10
  build:
 
26
 
27
  - uses: astral-sh/ruff-action@v3
28
  - run: ruff check
 
 
.github/workflows/docker-build-push.yaml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Docker Build and Push ghcr.io
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - release/*
8
+
9
+ jobs:
10
+ build-push:
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ contents: read
14
+ packages: write
15
+ env:
16
+ REGISTRY: ghcr.io
17
+ REPOSITORY: lokumai/openai-openapi-template
18
+ UID: 1000
19
+ USER: chameleon
20
+ steps:
21
+ - name: Checkout
22
+ uses: actions/checkout@v3
23
+
24
+ - name: Login to ghcr.io
25
+ uses: docker/login-action@v3
26
+ with:
27
+ registry: ${{ env.REGISTRY }}
28
+ username: ${{ github.actor }}
29
+ password: ${{ secrets.GITHUB_TOKEN }}
30
+
31
+ - name: Determine image tag
32
+ id: determine_tag
33
+ run: |
34
+ BRANCH_NAME=${{ github.ref_name }}
35
+ echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV
36
+
37
+ if [[ "$BRANCH_NAME" == "main" ]]; then
38
+ echo "TAG=latest" >> $GITHUB_ENV
39
+ elif [[ "$BRANCH_NAME" =~ ^release/v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
40
+ echo "TAG=${BASH_REMATCH[1]}" >> $GITHUB_ENV
41
+ else
42
+ echo "Invalid branch name format for release (expected: release/vX.Y.Z)"
43
+ exit 1
44
+ fi
45
+
46
+
47
+
48
+ - name: Build docker image
49
+ run: |
50
+ docker build \
51
+ --tag app:latest \
52
+ --build-arg UID=${{ env.UID }} \
53
+ --build-arg USER=${{ env.USER }} \
54
+ .
55
+
56
+ docker tag app:latest ${REGISTRY}/${REPOSITORY}:${TAG}
57
+ docker tag app:latest ${REGISTRY}/${REPOSITORY}:latest
58
+
59
+ - name: Push docker image
60
+ run: |
61
+ docker push ${REGISTRY}/${REPOSITORY}:${TAG}
62
+ docker push ${REGISTRY}/${REPOSITORY}:latest
63
+
64
+ - name: Clean up docker images
65
+ run: |
66
+ docker rmi -f app:latest
67
+ docker rmi -f ${REGISTRY}/${REPOSITORY}:${TAG}
68
+ docker rmi -f ${REGISTRY}/${REPOSITORY}:latest
pyproject.toml CHANGED
@@ -9,8 +9,7 @@ dependencies = [
9
  "fastapi>=0.115.12",
10
  "gradio>=5.30.0",
11
  "httpx>=0.28.1",
12
- "loguru>=0.7.3",
13
- "mongita>=1.2.0",
14
  "mongomock-motor>=0.0.36",
15
  "motor>=3.7.1",
16
  "plotly>=6.1.1",
 
9
  "fastapi>=0.115.12",
10
  "gradio>=5.30.0",
11
  "httpx>=0.28.1",
12
+ "loguru>=0.7.3",
 
13
  "mongomock-motor>=0.0.36",
14
  "motor>=3.7.1",
15
  "plotly>=6.1.1",