Skip to content

Commit

Permalink
Use local wheels in docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
mstimberg committed Mar 7, 2024
1 parent 50ac8ce commit 50db33d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:
name: Build docker image for release
runs-on: ubuntu-latest
environment: release
needs: deploy
needs: build-linux
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -170,7 +170,13 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push the Docker image
- name: load distribution 📦
uses: actions/download-artifact@v3
with:
name: packages
pattern: *cp312*.whl
path: dist/
- name: Build (and potentially push) the Docker image
uses: docker/build-push-action@v5
# https://github.com/docker/build-push-action
with:
Expand Down
23 changes: 12 additions & 11 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,23 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
g++ \
git \
libgs-dev \
python3-dev \
sudo
sudo \
&& rm -rf /var/lib/apt/lists/*

# Update system to use Python3 by default
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1
# Copy wheels into the image
COPY dist /tmp/dist

# Install Brian and recommended packages
RUN pip install \
brian2 \
brian2tools \
# Install Brian2 and recommended packages
ARG TARGETARCH
RUN pip install --no-cache-dir --only-binary=:all: \
scipy \
matplotlib \
jupyterlab \
pytest \
pytest-xdist
pytest-xdist \
&& if [ "${TARGETARCH}" = "arm64" ]; then WHEEL_ARCH=aarch64; else WHEEL_ARCH=x86_64; fi \
&& pip install /tmp/dist/Brian2*_${WHEEL_ARCH}.whl brian2tools \
&& rm -rf /tmp/dist

# Create a non-root user
ARG USER="monty" \
Expand All @@ -58,4 +59,4 @@ RUN git clone https://github.com/brian-team/brian2.git \
&& rm -rf brian2

EXPOSE 8888
CMD ["jupyter", "lab", "--ip=0.0.0.0"]
CMD ["jupyter", "lab", "--ip=0.0.0.0", "--no-browser"]

0 comments on commit 50db33d

Please sign in to comment.