| Bootstrap: docker | |
| From: python:3.8-slim-buster | |
| %setup | |
| # Commands to set up the build environment, if necessary | |
| mkdir -p /app | |
| %post | |
| # Set the working directory | |
| cd /app | |
| # Install system dependencies | |
| apt-get update && \ | |
| apt-get install -y build-essential openslide-tools libgl1-mesa-glx && \ | |
| apt-get clean && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Copy the application code | |
| cp -r $SINGULARITY_BUILDDEF_DIR/* /app/ | |
| # Install Python dependencies | |
| pip install -r /app/requirements.txt | |
| # Create a non-root user (similar to the Docker ARG approach) | |
| useradd -m -s /bin/bash -u ${USER_ID:-1000} myuser | |
| %environment | |
| # Set environment variables, if needed | |
| export HOME=/home/myuser | |
| export PATH=/app:$PATH | |
| %runscript | |
| # Script that is executed when the container is run | |
| exec /bin/bash | |
| %labels | |
| Author Vatsal_Patel | |
| Version version2 | |
| %files | |
| # Files to copy from the current directory into the container | |
| ./ /app/ | |