Skip to content

Commit

Permalink
Update Dockerfile.backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbie1977 authored Dec 14, 2024
1 parent bd04267 commit 54a1662
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions Dockerfile.backend
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@ FROM python:3.9-slim
# Set working directory
WORKDIR /app

# Install git and build tools
RUN apt-get update && \
apt-get install -y git build-essential && \
rm -rf /var/lib/apt/lists/*
# Install git, build tools, and OpenGL dependencies
RUN apt-get update && apt-get install -y \
git \
build-essential \
libgl1-mesa-glx \
libgl1-mesa-dev \
xvfb \
libglu1-mesa \
libosmesa6 \
freeglut3-dev \
&& rm -rf /var/lib/apt/lists/*

# Set up virtual display for OpenGL
ENV DISPLAY=:99

# Copy requirements files
COPY applications/virtual-fly-brain/backend/requirements.txt ./
Expand All @@ -24,11 +34,20 @@ RUN cd /app/VFBquery && pip install -e .
COPY applications/virtual-fly-brain/backend/virtual_fly_brain /app/virtual_fly_brain
COPY applications/virtual-fly-brain/backend/setup.py /app/

# Create and set up volume directories
RUN mkdir -p /app/data /app/cache
VOLUME ["/app/data", "/app/cache"]

# Set Python path
ENV PYTHONPATH=/app
ENV PYTHONPATH=/app \
PYTHONUNBUFFERED=1

# Expose port
EXPOSE 8080

# Create startup script
RUN echo '#!/bin/bash\nXvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &\nsleep 1\npython -m virtual_fly_brain' > /start.sh && \
chmod +x /start.sh

# Command to run the application
CMD ["python", "-m", "virtual_fly_brain"]
CMD ["/start.sh"]

0 comments on commit 54a1662

Please sign in to comment.