🐳 docker: fix image build (rust 1.97, python path, pydantic, entrypoint) + enable CI docker job
swadhinbiswas committed 2 months ago
f13c154
1 parent 4add5b8
commit f13c154
2 files changed
+10 -6
Showing 2 changed files+10-6
▼.github/workflows/ci.yml
+3-1
| @@ -381,7 +381,9 @@ jobs: | ||
381 | 381 | docker: |
382 | 382 | name: Build Docker Image |
383 | 383 | runs-on: ubuntu-latest |
384 | - needs: [check, pytest, integration-tests] | |
384 | + # integration-tests is disabled (if: false), so depend only on the jobs | |
385 | + # that actually run: rust checks + pytest. | |
386 | + needs: [check, pytest] | |
385 | 387 | if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) |
386 | 388 | steps: |
387 | 389 | - uses: actions/checkout@v4 |
388 | 390 | |
▼Dockerfile
+7-5
| @@ -1,7 +1,7 @@ | ||
1 | 1 | # ============================================================================= |
2 | 2 | # Stage 1: Build the Rust CLI binary and Python wheel |
3 | 3 | # ============================================================================= |
4 | -FROM rust:1.85-bookworm AS builder | |
4 | +FROM rust:1.97-bookworm AS builder | |
5 | 5 | |
6 | 6 | RUN apt-get update && apt-get install -y --no-install-recommends \ |
7 | 7 | libssl-dev pkg-config python3 python3-pip python3-venv \ |
| @@ -11,12 +11,10 @@ WORKDIR /app | ||
11 | 11 | |
12 | 12 | COPY Cargo.toml Cargo.lock ./ |
13 | 13 | COPY crates/ crates/ |
14 | -COPY python/ python/ | |
15 | 14 | |
16 | 15 | RUN python3 -m venv /opt/venv && \ |
17 | 16 | . /opt/venv/bin/activate && \ |
18 | - pip install maturin==1.8.3 && \ | |
19 | - pip install uv | |
17 | + pip install maturin uv | |
20 | 18 | ENV PATH="/opt/venv/bin:$PATH" |
21 | 19 | |
22 | 20 | RUN cargo build --release -p justapi-cli --features tls,compression |
| @@ -40,6 +38,9 @@ COPY --from=builder /app/wheels /tmp/wheels | ||
40 | 38 | |
41 | 39 | RUN pip install uv && uv pip install --system /tmp/wheels/*.whl && rm -rf /tmp/wheels |
42 | 40 | |
41 | +# demo_app.py uses pydantic for request validation | |
42 | +RUN pip install --no-cache-dir pydantic>=2.0 | |
43 | + | |
43 | 44 | COPY demo_app.py /app/ |
44 | 45 | |
45 | 46 | EXPOSE 8080 |
| @@ -52,4 +53,5 @@ USER justapi | ||
52 | 53 | HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ |
53 | 54 | CMD ["python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8080/live')"] |
54 | 55 | |
55 | -ENTRYPOINT ["justapi", "serve"] | |
56 | +# demo_app.py ends with app.run("127.0.0.1:8080") — run the Python app. | |
57 | +ENTRYPOINT ["python", "demo_app.py"] | |
56 | 58 | |