From 684c1424c6af04269a1157140b031240ce571c84 Mon Sep 17 00:00:00 2001 From: David Sapiro <115489098+Encord-davids@users.noreply.github.com> Date: Fri, 24 Feb 2023 12:21:12 +0000 Subject: [PATCH] feat: adds a dockerfile and a ci build and push (#206) * feat: adds a dockerfile and a ci build and push * docs: adds documentaion about docker usage --- .github/workflows/docker.yml | 44 ++++++++++++++++++++++++++++++++++++ Dockerfile | 31 +++++++++++++++++++++++++ docs/docs/getting-started.md | 12 +++++++++- docs/docs/installation.mdx | 20 ++++++++++++++++ 4 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/docker.yml create mode 100644 Dockerfile diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 000000000..6cd470c93 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,44 @@ +name: Docker build and publish + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + ${{ secrets.DOCKERHUB_USERNAME }}/encord-active + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile + push: true + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/encord-active:latest + cache-to: type=inline diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..2fb94e29e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +FROM python:3.9-slim + +ARG POETRY_VERSION="1.2.2" + +WORKDIR /app + +COPY .env pyproject.toml poetry.lock README.md /app +COPY ./src/ /app/src + +ENV PYTHONPATH=${PYTHONPATH}:${PWD} + +RUN apt-get update && apt-get install -y \ + build-essential \ + curl \ + software-properties-common \ + git \ + ffmpeg + +RUN apt-get -y clean \ + && rm -rf /var/lib/apt/lists/* + +RUN pip install . + +WORKDIR /data + +EXPOSE 8501 + +ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0 + +HEALTHCHECK CMD ecord-active --version +ENTRYPOINT ["encord-active"] diff --git a/docs/docs/getting-started.md b/docs/docs/getting-started.md index 3d1f88e48..330595c6e 100644 --- a/docs/docs/getting-started.md +++ b/docs/docs/getting-started.md @@ -22,13 +22,23 @@ source ea-venv/bin/activate pip install encord-active ``` -:::tip +:::info `encord-active` requires [python3.9](https://www.python.org/downloads/release/python-3915/) or above. If you have trouble installing `encord-active`, you can find more detailed instructions on installing it [here](./installation). ::: +:::tip + +You can also run the docker image instead of install Encord Active + +```shell +docker run -it -p 8501:8501 -v ${PWD}:/data encord/encord-active +``` + +::: + ## Encord Active Quickstart Understand Encord Active in **5 minutes** by playing! diff --git a/docs/docs/installation.mdx b/docs/docs/installation.mdx index 5bc831a75..d7bbfe208 100644 --- a/docs/docs/installation.mdx +++ b/docs/docs/installation.mdx @@ -54,3 +54,23 @@ This must be run in the same virtual environment where you installed your packag The `--help` option provides some context to what you can do with `encord-active`. To learn more about how to use the command line interface, see the [Command Line Interface section](category/command-line-interface). + +## Docker + +We also provide a docker image which works exctly the same as the cli. + +```shell +docker run -it --rm -p 8501:8501 -v ${PWD}:/data encord/encord-active +``` + +This will mount your current working directory, so everything that happens inside the docker container will persist after it is done. + +#### SSH key + +If you intend to use Encord Active with an Encord Annotate project you'll need to mount a voulume with your SSH key as well. + +```shell +docker run -it --rm -p 8501:8501 -v ${PWD}:/data -v ${HOME}/.ssh:/root/.ssh encord/encord-active +``` + +Then, when asked for your SSH key, you can point to `~/.ssh/`