Skip to content

Commit 1abe40a

Browse files
grieve54706goldmedal
authored andcommitted
feat(docker): make docker build with wren-modeling (#721)
1 parent 04f6b89 commit 1abe40a

File tree

11 files changed

+54
-23
lines changed

11 files changed

+54
-23
lines changed

.github/workflows/build-dev-image.yml

+3
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ jobs:
7272
uses: docker/build-push-action@v5
7373
with:
7474
context: ./ibis-server
75+
build-contexts: |
76+
wren-modeling-py=./wren-modeling-py
77+
wren-modeling-rs=./wren-modeling-rs
7578
platforms: linux/amd64,linux/arm64
7679
push: true
7780
tags: ${{ steps.meta.outputs.tags }}

.github/workflows/build-image.yml

+3
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ jobs:
8585
uses: docker/build-push-action@v5
8686
with:
8787
context: ./ibis-server
88+
build-contexts: |
89+
wren-modeling-py=./wren-modeling-py
90+
wren-modeling-rs=./wren-modeling-rs
8891
platforms: linux/amd64,linux/arm64
8992
push: true
9093
tags: ${{ steps.meta.outputs.tags }}

.github/workflows/stable-release.yml

+3
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ jobs:
128128
uses: docker/build-push-action@v5
129129
with:
130130
context: ./ibis-server
131+
build-contexts: |
132+
wren-modeling-py=./wren-modeling-py
133+
wren-modeling-rs=./wren-modeling-rs
131134
platforms: linux/amd64,linux/arm64
132135
push: true
133136
tags: ${{ steps.meta.outputs.tags }}

ibis-server/.dockerignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.venv
2+
target
3+
docs
4+
tests
5+
.pre-commit-config.yaml
6+
.env

ibis-server/Dockerfile

+16-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
FROM python:3.11-buster as builder
1+
FROM python:3.11-buster AS builder
22

33
# libpq-dev is required for psycopg2
44
RUN apt-get update && apt-get -y install libpq-dev
55

6+
# Install rust
7+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y
8+
ENV PATH="/root/.cargo/bin:$PATH"
9+
10+
# Install justfile
11+
RUN curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/bin
12+
613
# python
714
ENV PYTHONUNBUFFERED=1 \
815
PYTHONDONTWRITEBYTECODE=1 \
@@ -15,16 +22,17 @@ ENV PYTHONUNBUFFERED=1 \
1522
POETRY_VIRTUALENVS_IN_PROJECT=1 \
1623
POETRY_VIRTUALENVS_CREATE=1
1724

18-
RUN pip install poetry==1.7.1
25+
RUN pip install poetry==1.8.3
1926

20-
WORKDIR /app
27+
COPY --from=wren-modeling-py . /wren-modeling-py
28+
COPY --from=wren-modeling-rs . /wren-modeling-rs
2129

22-
COPY pyproject.toml ./
23-
COPY poetry.lock ./
30+
WORKDIR /app
31+
COPY . .
32+
RUN just install --without dev
2433

25-
RUN poetry install --without dev
2634

27-
FROM python:3.11-slim-buster as runtime
35+
FROM python:3.11-slim-buster AS runtime
2836

2937
# libpq-dev is required for psycopg2
3038
# unixodbc-dev, freetds-dev and tdsodbc are required for pyodbc
@@ -62,4 +70,4 @@ COPY app app
6270

6371
EXPOSE 8000
6472

65-
ENTRYPOINT fastapi run
73+
CMD ["fastapi", "run"]

ibis-server/docs/development.md

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ just pre-commit-install
2323
```
2424
This installs the pre-commit hooks.
2525

26-
> [!WARNING]
27-
> Before working on the application, you need to set up a Python virtual environment and install dependencies in the [wren-modeling-py](../../wren-modeling-py) directory.
28-
2926

3027
## Start the server
3128
To get the application running:

ibis-server/justfile

+7-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ default:
22
@just --list --unsorted
33

44
build-core:
5-
cd ../wren-modeling-py && just build
5+
cd ../wren-modeling-py && just install && just build
66

77
core-wheel-path := "../wren-modeling-py/target/wheels/wren_modeling_py-*.whl"
88

@@ -13,8 +13,8 @@ install-core: build-core
1313
update-core: build-core
1414
poetry run pip install --force-reinstall {{core-wheel-path}}
1515

16-
install:
17-
poetry install
16+
install *args:
17+
poetry install {{args}}
1818
just install-core
1919

2020
pre-commit-install:
@@ -38,7 +38,10 @@ test MARKER:
3838
docker-build:
3939
# alias for `docker-build`
4040
dbuild:
41-
docker image build . -t wren-engine-ibis
41+
docker buildx build -t wren-engine-ibis -f Dockerfile \
42+
--build-context wren-modeling-py=../wren-modeling-py \
43+
--build-context wren-modeling-rs=../wren-modeling-rs \
44+
.
4245

4346
docker-run:
4447
# alias for `docker-run`

wren-modeling-py/.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.venv
2+
target
3+
tests
4+
README.md
5+
rustfmt.toml

wren-modeling-py/poetry.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wren-modeling-py/pyproject.toml

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
[project]
22
name = "wren-modeling-py"
3-
classifiers = [
4-
"Programming Language :: Python :: 3.11"
5-
]
3+
classifiers = ["Programming Language :: Python :: 3.11"]
64

75
[tool.poetry]
86
name = "wren-modeling-py"
@@ -12,16 +10,14 @@ authors = ["Canner <[email protected]>"]
1210

1311
[tool.poetry.dependencies]
1412
python = ">=3.11,<3.12"
13+
maturin = "1.7.0"
1514

1615
[tool.poetry.group.dev.dependencies]
1716
pytest = "8.3.1"
18-
maturin = "1.7.0"
1917

2018
[tool.maturin]
2119
module-name = "wren_core"
22-
include = [
23-
{ path = "Cargo.lock", format = "sdist" }
24-
]
20+
include = [{ path = "Cargo.lock", format = "sdist" }]
2521
exclude = ["tests/**", "target/**"]
2622
locked = true
2723

wren-modeling-rs/.dockerignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
sqllogictest
2+
wren-example
3+
target
4+
README.md
5+
rustfmt.toml
6+
taplo.toml
7+
.gitignore

0 commit comments

Comments
 (0)