From f4a37bde0dcdd5608061738b135c90726a8ad4b1 Mon Sep 17 00:00:00 2001 From: "Dmitry A. Grechka" Date: Thu, 11 Aug 2022 01:26:33 +0300 Subject: [PATCH] drone.io build definition (#1) * drone.io build definition --- .drone.yml | 27 +++++++++++++++++++++++++++ Dockerfile | 6 ++---- code/test_embeddings.py | 4 +++- 3 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..e1283b9 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,27 @@ +--- +kind: pipeline +type: kubernetes +name: default + +steps: +- name: build & test docker image + image: plugins/docker + settings: + repo: lostpetinitiative/calvin_zhirui_feature_extractor + dry_run: true + #target: TESTS # this one fails on drone.io build + target: FINAL +- name: build & push docker image + image: plugins/docker + when: + event: + - tag + settings: + username: + from_secret: docker_username + password: + from_secret: docker_password + repo: lostpetinitiative/calvin_zhirui_feature_extractor + target: FINAL + auto_tag: true + force_tag: true \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index f61db23..00d5e31 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,11 +5,9 @@ RUN apt-get update && apt-get install --no-install-recommends -y ca-certificates RUN mkdir /app # downloading pretrained weights from Zenodo -RUN wget https://zenodo.org/record/6663662/files/head_swin_bnneck.zip -O /app/head_swin_bnneck.zip -RUN unzip /app/head_swin_bnneck.zip -d /app/head_swin_bnneck +RUN wget https://zenodo.org/record/6663662/files/head_swin_bnneck.zip -nv -O /app/head_swin_bnneck.zip +RUN unzip /app/head_swin_bnneck.zip model.ckpt cfg.yml -d /app/head_swin_bnneck RUN rm /app/head_swin_bnneck.zip -# last.ckpt is the same as model.ckpt, so deleting it to save image space -RUN rm /app/head_swin_bnneck/last.ckpt FROM python:3.9-slim AS FINAL diff --git a/code/test_embeddings.py b/code/test_embeddings.py index 063cf27..e211023 100644 --- a/code/test_embeddings.py +++ b/code/test_embeddings.py @@ -33,7 +33,9 @@ def test_process_job(self): output_job = infer.process_job(model, preproc_transform, job) - assert json.dumps(expected_output) == json.dumps(output_job) + exp_json = json.dumps(expected_output) + actual_json = json.dumps(output_job) + assert exp_json == actual_json, f"Output job does not match expected output {exp_json} {actual_json}" assert "yolo5_output" not in output_job