Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker improvements #601

Merged
merged 40 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
59821ad
Tidy up Dockerfile
bdevans Jul 5, 2023
4c5232b
Use best practice for pip
bdevans Jul 5, 2023
62be93d
Implement wheel builder
bdevans Jul 5, 2023
36695b5
Fix missing numpy and build command
bdevans Jul 5, 2023
453584d
Fix broken variable expansion with relative path
bdevans Jul 5, 2023
535c158
Generalise to choose python version
bdevans Jul 5, 2023
9ecfb1d
Try to fix missing pip
bdevans Jul 5, 2023
2b2fcba
Enable use of python not python3
bdevans Jul 5, 2023
df13a92
Fix pip version problem although it may still be using pip for python…
bdevans Jul 5, 2023
777fddf
Update labels
bdevans Jul 5, 2023
650ea5f
Remove cruft
bdevans Jul 5, 2023
7173468
More tidying
bdevans Jul 5, 2023
aa1517c
Rename Dockerfile.builder
bdevans Jul 26, 2023
006dc8a
Revise target
bdevans Jul 26, 2023
75a8104
Add syntax metadata
bdevans Jul 27, 2023
2a0e322
Change maintainer
bdevans Jul 27, 2023
7d7aff3
Fix typo
bdevans Jul 27, 2023
45eab7e
Install swig with pip
bdevans Jul 27, 2023
0bbbc1e
Create manylinux builder with script
bdevans Jul 27, 2023
03ce5a7
Add Makefile wheel target
bdevans Jul 27, 2023
e5afcf9
Rename and set execute permissions
bdevans Jul 27, 2023
6c65327
Fix path
bdevans Jul 27, 2023
467df85
Rename target
bdevans Jul 27, 2023
6b89724
Fix python path
bdevans Jul 27, 2023
454588d
Skip python 3.12 (still in beta)
bdevans Jul 27, 2023
4964c4c
Tidy up and add notes
bdevans Jul 27, 2023
0cb7461
Skip pypy builds
bdevans Jul 28, 2023
340e5b8
No need to make install
bdevans Jul 28, 2023
52d1114
Move make command outside of python loop
bdevans Jul 28, 2023
0faac71
Update default base image
bdevans Jul 28, 2023
198c5bc
Get versions and save as labels with build-arg
bdevans Jul 28, 2023
5f0bbcc
Restrict wheels to current python versions
bdevans Jul 28, 2023
bd4027b
Create all_wheels to build for all supported CUDA versions
bdevans Jul 28, 2023
ed4a23f
Fix syntax
bdevans Jul 28, 2023
dc90abc
Make all_wheels phony
bdevans Jul 28, 2023
412ca02
Add link to supported Python versions
bdevans Aug 3, 2023
06c85f3
Output to subdirectory named after CUDA version
bdevans Aug 3, 2023
e28b84c
Merge branch 'genn-team:master' into master
bdevans Oct 6, 2023
d1e97e1
Merge remote-tracking branch 'github/master' into ben_docker_improvem…
neworderofjamie Oct 11, 2023
29372db
small tweaks
neworderofjamie Oct 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 23 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
ARG BASE=11.5.0-devel-ubuntu20.04
FROM nvidia/cuda:${BASE}

LABEL maintainer="[email protected]"
LABEL version="4.8.0"
LABEL org.opencontainers.image.documentation="https://genn-team.github.io/"
LABEL org.opencontainers.image.source="https://github.com/genn-team/genn"
LABEL org.opencontainers.image.title="GeNN Docker image"

# Update APT database and upgrade any outdated packages
ARG GENN_VER
LABEL maintainer="[email protected]" \
version=${GENN_VER} \
org.opencontainers.image.documentation="https://genn-team.github.io/" \
org.opencontainers.image.source="https://github.com/genn-team/genn" \
org.opencontainers.image.title="GeNN Docker image"

# Update APT database and upgrade any outdated packages and install Python, pip and swig
RUN apt-get update && \
apt-get upgrade -y

# Install Python, pip and swig
RUN apt-get install -yq --no-install-recommends python3-dev python3-pip swig gosu nano

# Set CUDA environment variable
ENV CUDA_PATH=/usr/local/cuda
apt-get upgrade -y && \
apt-get install -yq --no-install-recommends python3-dev python3-pip swig gosu nano

ENV GENN_PATH=/opt/genn
# Set environment variables
ENV CUDA_PATH=/usr/local/cuda \
GENN_PATH=/opt/genn

# Upgrade pip itself
RUN pip install --upgrade pip
# Set python3 to be the default version of python
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1

# Install numpy and jupyter
RUN pip install numpy jupyter matplotlib
# Upgrade pip itself and install numpy and jupyter
RUN python -m pip install --upgrade pip && \
python -m pip install numpy jupyter matplotlib

# Copy GeNN into /opt
COPY . ${GENN_PATH}
COPY . ${GENN_PATH}

# Use this as working directory
WORKDIR ${GENN_PATH}

# Install GeNN and PyGeNN
RUN make install -j `lscpu -p | egrep -v '^#' | sort -u -t, -k 2,4 | wc -l`
RUN make DYNAMIC=1 LIBRARY_DIRECTORY=${GENN_PATH}/pygenn/genn_wrapper/ -j `lscpu -p | egrep -v '^#' | sort -u -t, -k 2,4 | wc -l`
RUN python3 setup.py develop

# Default command will be to launch bash
CMD ["/bin/bash"]
RUN python setup.py develop

# Start entrypoint
# **NOTE** in 'exec' mode shell arguments aren't expanded so can't use environment variables
ENTRYPOINT ["/opt/genn/bin/genn-docker-entrypoint.sh"]

# Default command will be to launch bash
CMD ["/bin/bash"]
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ clean:
@rm -f $(LIBGENN)
@rm -f $(BACKEND_LIBS)

GENN_VER := $(shell cat version.txt)
.PHONY docker-build:
docker-build:
@docker build -t genn:latest .
@docker build --build-arg GENN_VER=$(GENN_VER) -t genn:latest .