-
Notifications
You must be signed in to change notification settings - Fork 37
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
Add Dockerfile and build image flow #567
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
0bbabc5
Add Dockerfile
grieve54706 71b77e7
Make ibis version same as java engine
grieve54706 18a0750
Add CI
grieve54706 9c92ea7
Make python dependencies install in the Docker
grieve54706 822b242
Use docker/build-push-action
grieve54706 7fff6a6
Fix tag name
grieve54706 59ecc1b
Add docker/metadata-action
grieve54706 6c9f8be
Fix Dockerfile path
grieve54706 7b8a6b2
Fix context
grieve54706 55a33d0
Fix tag
grieve54706 639b7e3
Update README
grieve54706 2ddf7d1
Remove invalid default working-directory
grieve54706 003da24
Fix pyproject.toml path
grieve54706 34eed7e
Use step.working-directory
grieve54706 4bbbda0
Use poetry version
grieve54706 a885481
Add empty line in the end of file
grieve54706 88081c2
Edit title
grieve54706 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
FROM python:3.11-buster as builder | ||
|
||
# libpq-dev is required for psycopg2 | ||
RUN apt-get update && apt-get -y install libpq-dev | ||
|
||
# python | ||
ENV PYTHONUNBUFFERED=1 \ | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
# pip | ||
PIP_NO_CACHE_DIR=off \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=on \ | ||
PIP_DEFAULT_TIMEOUT=100 \ | ||
# poetry | ||
POETRY_NO_INTERACTION=1 \ | ||
POETRY_VIRTUALENVS_IN_PROJECT=1 \ | ||
POETRY_VIRTUALENVS_CREATE=1 | ||
|
||
RUN pip install poetry==1.7.1 | ||
|
||
WORKDIR /app | ||
|
||
COPY pyproject.toml ./ | ||
|
||
RUN poetry install --without dev | ||
|
||
FROM python:3.11-slim-buster as runtime | ||
|
||
# libpq-dev is required for psycopg2 | ||
RUN apt-get update \ | ||
&& apt-get -y install libpq-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ENV VIRTUAL_ENV=/app/.venv \ | ||
PATH="/app/.venv/bin:$PATH" | ||
|
||
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV} | ||
COPY app app | ||
|
||
EXPOSE 8000 | ||
|
||
ENTRYPOINT fastapi run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -13,3 +13,9 @@ dev: | |||||
|
||||||
test: | ||||||
poetry run pytest | ||||||
|
||||||
docker-build: | ||||||
docker image build . -t wren-engine-ibis | ||||||
|
||||||
docker-run: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
How about add a |
||||||
docker run -it --rm -p 8000:8000 --env-file .env wren-engine-ibis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,59 @@ | ||
# Ibis server | ||
|
||
## Environment Setup | ||
## Quick Start | ||
### Running on Docker | ||
Pull the image from the GitHub Container Registry | ||
```bash | ||
docker pull ghcr.io/canner/wren-engine-ibis:latest | ||
``` | ||
Create `.env` file and fill in the environment variables (see [Environment Variables](#Environment-Variables)) \ | ||
```bash | ||
vim .env | ||
``` | ||
Run the container | ||
```bash | ||
docker run --env-file .env -p 8000:8000 ghcr.io/canner/wren-engine-ibis:latest | ||
``` | ||
### Running on Local | ||
Requirements: | ||
- Python 3.11 | ||
- [poetry](https://github.com/python-poetry/poetry) 1.7.1 | ||
|
||
Clone the repository and navigate to the ibis directory | ||
```bash | ||
git clone git@github.com:Canner/wren-engine.git | ||
cd ibis-server | ||
``` | ||
Create `.env` file and fill in the environment variables (see [Environment Variables](#Environment-Variables)) | ||
```bash | ||
vim .env | ||
``` | ||
Install the dependencies | ||
```bash | ||
make install | ||
``` | ||
Run the server | ||
```bash | ||
make run | ||
``` | ||
|
||
## Developer Guide | ||
|
||
### Environment Setup | ||
- Python 3.11 | ||
- Install `poetry` with version 1.7.1: `curl -sSL https://install.python-poetry.org | python3 - --version 1.7.1` | ||
- Execute `make install` to install the dependencies | ||
- Execute `make test` to run the tests | ||
- Create `.env` file and fill in the environment variables | ||
|
||
## Environment Variables | ||
### Environment Variables | ||
- `WREN_ENGINE_ENDPOINT`: The endpoint of the Wren engine | ||
|
||
## Start the server | ||
### Start the server | ||
- Execute `make run` to start the server | ||
- Execute `make dev` to start the server in development mode. It will auto-reload after the code is edited. | ||
- Default port is `8000`, you can change it by `make run PORT=8001` or `make dev PORT=8001` | ||
|
||
### Docker | ||
- Build the image: `make docker-build` | ||
- Run the container: `make docker-run` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First time to know this action to put the image tags. it's really concise!