Skip to content

Commit 2bdf9aa

Browse files
committed
Docker integration
1 parent db6fc79 commit 2bdf9aa

File tree

6 files changed

+111
-25
lines changed

6 files changed

+111
-25
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ html/*
1212
docs/
1313
venv*
1414
tests/
15+
.ipynb_checkpoints

.github/workflows/checks.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: "Checks and dev env deploy"
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
checks:
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Set up Python
13+
uses: actions/setup-python@v2
14+
with:
15+
python-version: "3.7"
16+
- name: Install dependencies
17+
run: |
18+
python -m pip install --upgrade pip
19+
pip install setuptools wheel twine yapf sphinx sphinx_rtd_theme
20+
pip install shapely
21+
pip install -r requirements.txt
22+
- name: Check formatting
23+
run: yapf -p -r --diff superannotate
24+
- name: Check docs
25+
run: make docs
26+
deploy_dev:
27+
runs-on: ubuntu-20.04
28+
steps:
29+
- uses: actions/checkout@v2
30+
-
31+
name: Set up QEMU
32+
uses: docker/setup-qemu-action@v1
33+
-
34+
name: Set up Docker Buildx
35+
uses: docker/setup-buildx-action@v1
36+
-
37+
name: Login to DockerHub
38+
uses: docker/login-action@v1
39+
with:
40+
username: ${{ secrets.DOCKER_USERNAME }}
41+
password: ${{ secrets.DOCKER_PASSWORD }}
42+
-
43+
name: Build and push to Docker Hub
44+
id: docker_build
45+
uses: docker/build-push-action@v2
46+
with:
47+
push: true
48+
file: Dockerfile_dev
49+
tags: superannotate/pythonsdk-dev-env:latest
50+

Dockerfile_dev

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM ubuntu:20.04
2+
ENV LANG C.UTF-8
3+
4+
SHELL ["/bin/bash", "-c"]
5+
6+
ENV DEBIAN_FRONTEND noninteractive
7+
ENV HOME /root
8+
WORKDIR $HOME
9+
10+
RUN apt-get update && apt-get install -y --no-install-recommends \
11+
ca-certificates python3 python3-pip python3-venv ffmpeg libgl1-mesa-dev libglib2.0-0 libsm6 libxrender1 libxext6 nano vim htop && \
12+
rm -rf /var/lib/apt/lists/*
13+
14+
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1
15+
RUN update-alternatives --install /usr/local/bin/pip pip /usr/bin/pip3 1
16+
17+
ENV VIRTUAL_ENV=$HOME/venv_superannotatesdk
18+
RUN python -m venv ${VIRTUAL_ENV}
19+
ENV PATH="${VIRTUAL_ENV}/bin:$PATH"
20+
21+
COPY . $HOME/superannotate-python-sdk
22+
23+
RUN pip install --no-cache-dir -e superannotate-python-sdk && \
24+
pip install --no-cache-dir jupyterlab && \
25+
pip install --no-cache-dir pytest pytest-xdist pytest-timeout && \
26+
pip install --no-cache-dir coverage pytest-cov && \
27+
pip install --no-cache-dir pylint pylint-json2html pylint-pytest && \
28+
pip install --no-cache-dir yapf && \
29+
pip install --no-cache-dir sphinx sphinx_rtd_theme && \
30+
pip install --no-cache-dir twine && \
31+
pip install --no-cache-dir xeus-python notebook && \
32+
rm -rf /root/.cache/pip
33+
34+
CMD ["jupyter", "lab", "--allow-root", "--NotebookApp.token=''", "--NotebookApp.password=''", "--no-browser", "--ip", "0.0.0.0"]

docker-compose-dev.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: "3.7"
2+
services:
3+
superannotate_pythonsdk_dev_env:
4+
image: superannotate/pythonsdk-dev-env:latest
5+
build:
6+
context: .
7+
dockerfile: Dockerfile_dev
8+
ports:
9+
- "8888:8888"
10+
volumes:
11+
- ${HOME}/.superannotate:/root/.superannotate
12+
- .:/root/superannotate-python-sdk
13+
command: >
14+
bash -c "pip install -e superannotate-python-sdk && jupyter lab --allow-root --NotebookApp.token='' --NotebookApp.password='' --no-browser --ip 0.0.0.0"
15+
init: true
16+
stdin_open: true
17+
tty: true

run_dev_env_in_container.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
# docker build -t superannotate/pythonsdk-dev-env:latest -f Dockerfile_dev .
4+
# docker pull superannotate/pythonsdk-dev-env:latest
5+
6+
docker run -it --rm -p 8888:8888 \
7+
-v ${HOME}/.superannotate:/root/.superannotate \
8+
-v $(pwd):/root/superannotate-python-sdk superannotate/pythonsdk-dev-env \
9+
bash -c "pip install -e superannotate-python-sdk && jupyter lab --allow-root --NotebookApp.token='' --NotebookApp.password='' --no-browser --ip 0.0.0.0"

0 commit comments

Comments
 (0)