Skip to content

Commit 0c4e47a

Browse files
committed
add docker
1 parent a08573e commit 0c4e47a

File tree

3 files changed

+39
-4
lines changed

3 files changed

+39
-4
lines changed

Dockerfile

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder
77
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
88

9+
# Install GDAL build dependencies (for fiona Python package)
10+
USER root
11+
RUN apt-get update \
12+
&& apt-get install -y --no-install-recommends \
13+
build-essential \
14+
gdal-bin \
15+
libgdal-dev \
16+
python3-dev \
17+
&& rm -rf /var/lib/apt/lists/*
18+
919
# Disable Python downloads, because we want to use the system interpreter
1020
# across both images. If using a managed Python version, it needs to be
1121
# copied from the build image into the final image; see `standalone.Dockerfile`
@@ -28,12 +38,22 @@ FROM python:3.12-slim-bookworm
2838
# Python executable must be the same, e.g., using `python:3.11-slim-bookworm`
2939
# will fail.
3040

41+
# Install GDAL runtime library (for fiona Python package)
42+
RUN apt-get update \
43+
&& apt-get install -y --no-install-recommends \
44+
libgdal-dev \
45+
&& rm -rf /var/lib/apt/lists/*
46+
3147
# Copy the application from the builder
3248
COPY --from=builder --chown=app:app /app /app
3349

3450
# Place executables in the environment at the front of the path
3551
ENV PATH="/app/.venv/bin:$PATH"
3652

37-
# # Run the FastAPI application by default
38-
# CMD ["fastapi", "dev", "--host", "0.0.0.0", "/app/src/uv_docker_example"]
53+
# disable Kedro telemetry
54+
ENV KEDRO_DISABLE_TELEMETRY=1
55+
56+
WORKDIR /app
57+
# Run Kedro pipelines
58+
CMD ["kedro", "run", "--async"]
3959

Justfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,12 @@ test:
2121

2222
validate: format lint test
2323

24-
dockerize:
24+
docker-build:
2525
docker build -t geolocation-pipeline .
26+
27+
docker-run:
28+
# Bind‑mount the host .data/ folder into the container so that the pipelines'
29+
# outputs are saved in the host's local .data/ folder
30+
docker run --rm \
31+
-v "$(pwd)/data:/app/data" \
32+
geolocation-pipeline

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,17 @@ The image below shows the pipelines visualization for this project:
117117
This project includes a multi-stage Dockerfile, which produces an image with the code and the dependencies installed. You can build the image with:
118118

119119
```bash
120-
just dockerize
120+
just docker-build
121121
```
122122

123+
Then, you can run the Kedro pipelines inside a container with the image you just built by running:
124+
125+
```bash
126+
just docker-run
127+
```
128+
129+
The outputs of the pipelines will still be saved in your local `data/` folder, because the docker container mounts the `data/` folder as a volume.
130+
123131
### Github Actions
124132

125133
This project includes a Github Actions workflow that runs the formatters, linters, and tests on every push/PR to the `main` or `develop` branches. You can find the workflow file in `.github/workflows/format-lint-test.yml`.

0 commit comments

Comments
 (0)