Skip to content

Commit

Permalink
Build package in container multi-stage build to ensure correct versio…
Browse files Browse the repository at this point in the history
…ning
  • Loading branch information
jacobtomlinson committed Apr 29, 2024
1 parent 4c3fcf0 commit db84b3e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.*
Dockerfile
dist/
15 changes: 12 additions & 3 deletions dask_kubernetes/operator/deployment/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
# This images needs to be built from the top level of the project
# $ docker build -t ghcr.io/dask/dask-kubernetes-operator:latest -f dask_kubernetes/operator/deployment/Dockerfile .

FROM python:3.10
FROM python:3.10 as builder

# Copy source
COPY . /src/dask_kubernetes
WORKDIR /src/dask_kubernetes

# Install dependencies
RUN pip install .
# Build dask-kubernetes distribution
RUN pip install hatch && hatch build

FROM python:3.10

# Copy wheel
COPY --from=builder /src/dask_kubernetes/dist /src/dask_kubernetes/dist
WORKDIR /src/dask_kubernetes

# Install from wheel
RUN pip install /src/dask_kubernetes/dist/dask_kubernetes*.whl

# Add non-root user
RUN useradd -s /bin/bash dask
Expand Down

0 comments on commit db84b3e

Please sign in to comment.