Skip to content

Commit 360239b

Browse files
authored
Merge pull request #6 from semi-technologies/switch-to-github-actions
Switch to github actions and update dependencies to newest versions
2 parents f1a3021 + f73dea8 commit 360239b

File tree

6 files changed

+80
-53
lines changed

6 files changed

+80
-53
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Ci related folders
2+
/.github/ @semi-technologies/core
3+
/cicd/ @semi-technologies/core

.github/workflows/main.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- '**'
9+
paths-ignore:
10+
- README.md
11+
- LICENSE
12+
pull_request:
13+
14+
jobs:
15+
build-image:
16+
name: Build image
17+
runs-on: ubuntu-latest
18+
env:
19+
LOCAL_REPO: img2vec-pytorch
20+
REMOTE_REPO: semitechnologies/img2vec-pytorch
21+
MODEL_NAME: resnet50
22+
steps:
23+
- uses: actions/checkout@v3
24+
- uses: actions/setup-python@v4
25+
with:
26+
python-version: "3.10"
27+
- name: Login to Docker Hub
28+
if: ${{ !github.event.pull_request.head.repo.fork }}
29+
uses: docker/login-action@v2
30+
with:
31+
username: ${{secrets.DOCKER_USERNAME}}
32+
password: ${{secrets.DOCKER_PASSWORD}}
33+
- name: Build and test
34+
run: |
35+
cicd/build.sh || exit 1
36+
cicd/test.sh || exit 1
37+
- name: Deploy
38+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
39+
env:
40+
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
41+
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
42+
run: |
43+
export GIT_TAG=${GITHUB_REF##*/}
44+
cicd/docker_push.sh || exit 1
45+
build-custom-image:
46+
name: Build custom image
47+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
48+
runs-on: ubuntu-latest
49+
env:
50+
LOCAL_REPO: img2vec-pytorch
51+
REMOTE_REPO: semitechnologies/img2vec-pytorch
52+
steps:
53+
- uses: actions/checkout@v3
54+
- uses: actions/setup-python@v4
55+
with:
56+
python-version: "3.10"
57+
- name: Login to Docker Hub
58+
uses: docker/login-action@v2
59+
with:
60+
username: ${{secrets.DOCKER_USERNAME}}
61+
password: ${{secrets.DOCKER_PASSWORD}}
62+
- name: Deploy
63+
env:
64+
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
65+
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
66+
run: |
67+
export GIT_TAG=${GITHUB_REF##*/}
68+
cicd/build_custom_base.sh || exit 1

.travis.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
FROM python:3.8-slim-buster
1+
FROM python:3.10-slim-bullseye
22

33
WORKDIR /app
44

55
COPY requirements.txt .
6-
RUN pip3 install -r requirements.txt
6+
RUN apt-get update && apt-get upgrade && apt-get -y install curl build-essential && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && pip3 install -r requirements.txt && apt remove -y curl build-essential && apt -y autoremove
7+
ENV PATH="$PATH:/root/.cargo/bin"
78

89
ARG MODEL_NAME
910
COPY download_model.py .

app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def live_and_ready(response: Response):
3636

3737

3838
@app.post("/vectors")
39+
@app.post("/vectors/")
3940
def read_item(item: VectorImagePayload, response: Response):
4041
try:
4142
vector = imgVec.vectorize(item.id, item.image)

requirements.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
fastapi==0.85.1
2-
torch==1.13.0
3-
torchvision==0.14.0
4-
uvicorn==0.19.0
5-
Pillow==9.2.0
1+
fastapi==0.89.1
2+
torch==1.13.1
3+
torchvision==0.14.1
4+
uvicorn==0.20.0
5+
Pillow==9.4.0

0 commit comments

Comments
 (0)