Skip to content

Added docker folder with Dockerfile for local development #237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM continuumio/miniconda3:23.3.1-0

# Install nodejs v18
RUN apt-get update && \
apt-get install -y curl && \
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs

# Install pnpm and few python code-generator deps
# Taken from .github/workflows/ci.yml
RUN pip install --upgrade wheel setuptools pip && \
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu && \
pip install pytorch-ignite pyyaml albumentations image_dataset_viz pytest transformers datasets tensorboard

ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright

RUN apt-get install -y unzip && \
npm i -g pnpm && \
# We may want to match playwright-chromium version from package.json
npm i -g [email protected] && \
npx playwright install --with-deps
48 changes: 48 additions & 0 deletions docker/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Docker image for local development

## Build development docker image

```bash
# Assuming the current folder to be code-generator source root folder
cd docker
docker build --tag pytorchignite/codegenerator:dev .
cd ../
```

## Run the image as a container

Assumptions:

- `$PWD` is code-generator source root folder
- To replace `/host/path/to/data` with a path to the input data (for example CIFAR10 and/or VOCdevkit etc), e.g. `/mnt/data`

```bash
# Assuming the current folder to be code-generator source root folder
docker run --name=codegen-dev -it -v $PWD:/code -w /code -v /host/path/to/data:/data --network=host --ipc=host pytorchignite/codegenerator:dev /bin/bash
```

Inside the container we can install all other project dependencies:

```bash
git config --global --add safe.directory /code

pnpm i --frozen-lockfile --color
pnpm build

bash scripts/run_code_style.sh install
```

- Local app deployment

```bash
pnpm dev
```

- Run ci tests locally

```bash
pnpm test:ci

sh ./scripts/run_tests.sh unzip
sh ./scripts/run_tests.sh simple vision-classification
```