Skip to content

Commit

Permalink
feat: adds a dockerfile and a ci build and push (#206)
Browse files Browse the repository at this point in the history
* feat: adds a dockerfile and a ci build and push

* docs: adds documentaion about docker usage
  • Loading branch information
Encord-davids authored Feb 24, 2023
1 parent 91ee5b3 commit 684c142
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 1 deletion.
44 changes: 44 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
12 changes: 11 additions & 1 deletion docs/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <command>
```

:::

## Encord Active Quickstart

Understand Encord Active in **5 minutes** by playing!
Expand Down
20 changes: 20 additions & 0 deletions docs/docs/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <command>
```

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/<your-key-file>`

0 comments on commit 684c142

Please sign in to comment.