Skip to content
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

Feature/docker support #90

Open
wants to merge 13 commits into
base: dev
Choose a base branch
from

Conversation

dbsectrainer
Copy link

  • Add Dockerfile for containerization
  • Add docker-compose.yml for easy deployment
  • Add docker-entrypoint.sh for container initialization
  • Add configuration templates and documentation
  • Support API key configuration through environment variables
  • Add comprehensive Docker setup instructions

Fixes #85

- Add Dockerfile for containerization
- Add docker-compose.yml for easy deployment
- Add docker-entrypoint.sh for container initialization
- Add configuration templates and documentation
- Support API key configuration through environment variables
- Add comprehensive Docker setup instructions

Fixes microsoft#85
microsoft#85)

- Add development environment with hot-reloading
- Support both development and production modes
- Update documentation with Docker usage instructions
- Add troubleshooting guides
- Improve configuration options
- Update DEVELOPMENT.md with Docker instructions

Fixes microsoft#85
@dbsectrainer
Copy link
Author

@microsoft-github-policy-service agree

@danmarshall
Copy link
Collaborator

Thanks! Does it also work on Windows? I see a .sh file

&& rm -rf /var/lib/apt/lists/*

# Install Node.js and yarn
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason why you use Node v18 here? How about using the more recent v20 (maintenance LTS) or v22 (active LTS)? https://nodejs.org/en/about/previous-releases

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating to v22

@danmarshall
Copy link
Collaborator

I tried running, I got this error:

 => [data-formulator-dev development  4/12] WORKDIR /app                                                                                                                                  0.2s
 => [data-formulator-dev development  5/12] RUN mkdir -p /app/config                                                                                                                      0.5s
 => ERROR [data-formulator-dev development  6/12] COPY docker-entrypoint.sh /app/                                                                                                         0.0s

dependabot bot and others added 3 commits February 20, 2025 21:54
Bumps [dompurify](https://github.com/cure53/DOMPurify) from 3.1.7 to 3.2.4.
- [Release notes](https://github.com/cure53/DOMPurify/releases)
- [Commits](cure53/DOMPurify@3.1.7...3.2.4)

---
updated-dependencies:
- dependency-name: dompurify
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
add multi-table readme message
Dev: provide ability to set timeout options, and improved backend logging so that users can provide feedback
buddypia and others added 3 commits March 1, 2025 15:42
feat(docker): Update Docker configuration and add README documentation

- Update Python from 3.11 to 3.12 in both development and production environments
- Update Node.js from v18 to v22
- Fix docker-entrypoint.sh path in Dockerfile
- Add preprocessing step to remove "-e ." from requirements.txt before installation
- Add Docker section to main README.md with setup instructions for both development and production modes

This update improves the Docker configuration with newer runtime versions and fixes path issues, while also making Docker support more visible to users through README documentation.
@dbsectrainer
Copy link
Author

dbsectrainer commented Mar 3, 2025

 => [data-formulator-dev development  4/12] WORKDIR /app                                                                                                                                  0.2s
 => [data-formulator-dev development  5/12] RUN mkdir -p /app/config                                                                                                                      0.5s
 => ERROR [data-formulator-dev development  6/12] COPY docker-entrypoint.sh /app/   

Addressed issue in recent change. successfully builds now.

…rn/dompurify-3.2.4

Bump dompurify from 3.1.7 to 3.2.4
…ys-button

Feature/toggle show keys button. If the deployment decides to disable show keys, then there is no option to show keys in the frontend.
@Chenglong-MS Chenglong-MS requested a review from Copilot March 3, 2025 17:04
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR adds Docker support to Data Formulator, enabling containerized development and production deployments for consistent environments.

  • Added a comprehensive Docker README with quick start instructions and troubleshooting tips.
  • Introduced a docker-compose.yml to define development and production services with appropriate environment settings and volume mounts.
  • Expanded the existing DEVELOPMENT documentation with Docker build options.

Reviewed Changes

File Description
docker/README.md New documentation detailing Docker usage and configuration.
README.md Updated main README to include Docker as a deployment option.
docker/docker-compose.yml New file defining container services for development and production.
DEVELOPMENT.md Documentation updated with Docker build and run instructions.

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

dockerfile: docker/Dockerfile
target: production
ports:
- "5000:5000"
Copy link
Preview

Copilot AI Mar 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The production service port mapping in the docker-compose file ('5000:5000') does not match the custom port configuration example in docker/README.md ('8080:5000'). Consider aligning these for consistency.

Suggested change
- "5000:5000"
- "8080:5000"

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@Chenglong-MS
Copy link
Collaborator

I run into multiple issues trying to work with this docker setup:

  1. I run into the problem of Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/app/docker-entrypoint.sh": stat /app/docker-entrypoint.sh: no such file or directory: unknown doing docker compose. I need to fix by updating entrypoint setup in docker-compose.yml with entrypoint: ["/bin/bash", "/app/docker/docker-entrypoint.sh"]

  2. Still have trouble opening the page on docker, I tried adding --host to do network mapping but it somehow doesn't work yet.

- Align port mapping in docker-compose.yml with README.md example (5000:5000 → 8080:5000)
- Fix entrypoint script path issue by adding explicit entrypoint configurations
- Add network binding (--host 0.0.0.0) for better container accessibility
- Resolves container startup errors and network access issues
@Chenglong-MS
Copy link
Collaborator

Thanks for the quick fix! I still run into some issue:

  1. entrypoint: [ "/bin/bash", "/app/docker/docker-entrypoint.sh" ] --> entrypoint: [ "/bin/bash", "/app/docker-entrypoint.sh" ] since it is copied as /app/docker-entrypoint.sh

  2. still have issue routing 127.0.0.1 to my browser

# Docker Configuration Changes

## Fixed Issues
- Fixed Python module import error by updating PYTHONPATH in docker-entrypoint.sh
- Resolved conflict between docker-compose.yml command and entrypoint script
- Added solution for Flask static files in development mode
- Ensured proper frontend-backend connectivity in Docker environment

## Changes Made

### docker-entrypoint.sh
1. Updated PYTHONPATH to correctly include the py-src directory:
   ```bash
   export PYTHONPATH=$PYTHONPATH:/app/py-src
   ```

2. Added code to create a simple index.html file in the Flask static directory:
   ```bash
   # Create dist directory if it doesn't exist
   mkdir -p /app/py-src/data_formulator/dist

   # Create a simple index.html file that redirects to the Vite dev server
   cat > /app/py-src/data_formulator/dist/index.html << 'EOF'
   <!DOCTYPE html>
   <html>
   <head>
       <meta http-equiv="refresh" content="0;URL='http://localhost:5173'" />
   </head>
   <body>
       <p>Redirecting to development server...</p>
   </body>
   </html>
   EOF
   ```

3. Updated the frontend server start command to include host option:
   ```bash
   yarn start --host 0.0.0.0
   ```

### docker-compose.yml
1. Removed the command override that was conflicting with the entrypoint script:
   ```yaml
   # Removed: command: sh -c "yarn && yarn start --host 0.0.0.0"
   ```

### docker/README.md
1. Updated Development Mode section to clarify:
   - Frontend access at http://localhost:5173
   - Backend API access at http://localhost:5001
   - Both servers running in the same container

2. Added troubleshooting information for backend and frontend connection issues

## How It Works Now
- The entrypoint script correctly sets up the Python environment
- Both frontend (Vite) and backend (Flask) servers start properly
- Frontend is accessible at http://localhost:5173
- Backend API is accessible at http://localhost:5001
- Flask serves a redirect page when accessed directly
- Development mode with hot-reloading works as expected

These changes ensure that the Docker development environment works correctly with both the frontend and backend components of Data Formulator.
@dbsectrainer
Copy link
Author

Thanks for the quick fix! I still run into some issue:

  1. entrypoint: [ "/bin/bash", "/app/docker/docker-entrypoint.sh" ] --> entrypoint: [ "/bin/bash", "/app/docker-entrypoint.sh" ] since it is copied as /app/docker-entrypoint.sh
  2. still have issue routing 127.0.0.1 to my browser

You should now be able to run command "docker compose -f docker/docker-compose.yml down && docker compose -f docker/docker-compose.yml up --build data-formulator-dev" and see tool on port :5173

@Chenglong-MS
Copy link
Collaborator

Chenglong-MS commented Mar 3, 2025 via email

@dbsectrainer dbsectrainer changed the base branch from main to dev March 4, 2025 00:31
@dbsectrainer
Copy link
Author

Updated PR branch to dev as requested

Can you do this PR to dev branch? I’ll still need to tweak some minor stuff there, especially for the data-formulator-dev

________________________________ From: Donnivis Baker @.> Sent: Monday, March 3, 2025 11:26:07 AM To: microsoft/data-formulator @.> Cc: Chenglong Wang @.>; Comment @.> Subject: Re: [microsoft/data-formulator] Feature/docker support (PR #90) Thanks for the quick fix! I still run into some issue: 1. entrypoint: [ "/bin/bash", "/app/docker/docker-entrypoint.sh" ] --> entrypoint: [ "/bin/bash", "/app/docker-entrypoint.sh" ] since it is copied as /app/docker-entrypoint.sh 2. still have issue routing 127.0.0.1 to my browser You should now be able to run command "docker compose -f docker/docker-compose.yml down && docker compose -f docker/docker-compose.yml up --build data-formulator-dev" and see tool on port :5173 — Reply to this email directly, view it on GitHub<#90 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWJXEPEQUGQ4VY47DHKEWI32SSUE7AVCNFSM6AAAAABXDTTYCGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMOJVGM2DEMJUGY. You are receiving this because you commented.Message ID: @.> [dbsectrainer]dbsectrainer left a comment (microsoft/data-formulator#90)<#90 (comment)> Thanks for the quick fix! I still run into some issue: 1. entrypoint: [ "/bin/bash", "/app/docker/docker-entrypoint.sh" ] --> entrypoint: [ "/bin/bash", "/app/docker-entrypoint.sh" ] since it is copied as /app/docker-entrypoint.sh 2. still have issue routing 127.0.0.1 to my browser You should now be able to run command "docker compose -f docker/docker-compose.yml down && docker compose -f docker/docker-compose.yml up --build data-formulator-dev" and see tool on port :5173 — Reply to this email directly, view it on GitHub<#90 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWJXEPEQUGQ4VY47DHKEWI32SSUE7AVCNFSM6AAAAABXDTTYCGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMOJVGM2DEMJUGY. You are receiving this because you commented.Message ID: @.>

Updated PR branch as requested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docker Support
5 participants