diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..91a8b29d --- /dev/null +++ b/docker/Dockerfile @@ -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 playwright-chromium@1.33.0 && \ + npx playwright install --with-deps diff --git a/docker/readme.md b/docker/readme.md new file mode 100644 index 00000000..40cf6e4a --- /dev/null +++ b/docker/readme.md @@ -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 +```