Spaces:
Build error
Build error
File size: 1,934 Bytes
8297f0d 0616139 8297f0d 0616139 fcdafa1 8297f0d fcdafa1 8297f0d fcdafa1 8297f0d 88c6d69 1d363ef 88c6d69 1d363ef 0616139 8297f0d fcdafa1 8297f0d fcdafa1 8297f0d fcdafa1 164ad30 504f9aa fcdafa1 164ad30 504f9aa 8297f0d 164ad30 504f9aa 8297f0d 164ad30 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
FROM nikolaik/python-nodejs:python3.11-nodejs21
# Install nginx, netcat-openbsd, and lsof
USER root
RUN apt-get -y update && apt-get -y install nginx netcat-openbsd lsof
# Setup directory structure for Nginx
RUN mkdir -p /var/cache/nginx \
/var/log/nginx \
/var/lib/nginx \
/var/www/html \
/usr/share/nginx/html
RUN touch /var/run/nginx.pid && touch /var/log/nginx/error.log
# Give permissions to 'pn' user for Nginx and static files directory
RUN chown -R pn:pn /var/cache/nginx \
/var/log/nginx \
/var/lib/nginx \
/var/run/nginx.pid \
/var/www/html \
/var/log/nginx/error.log \
/usr/share/nginx/html
# Install ollama
RUN curl -fsSL https://ollama.com/install.sh | sh
# Create the directory and give appropriate permissions
RUN mkdir -p /.ollama && chmod 777 /.ollama
WORKDIR /.ollama
# Set the OLLAMA_HOST environment variable
ENV OLLAMA_HOST=0.0.0.0
# Switch back to the 'pn' user for installing dependencies and building the app
USER pn
ENV HOME=/home/pn \
PATH=/home/pn/.local/bin:$PATH
WORKDIR $HOME/app
# Copy the requirements and install Python dependencies
COPY --chown=pn requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Handling frontend setup: Install dependencies and build
COPY --chown=pn frontend frontend
WORKDIR $HOME/app/frontend
RUN npm install
RUN npm run build && cp -r dist/. /usr/share/nginx/html && ls /usr/share/nginx/html
# Switch back to the app directory and setup the backend
WORKDIR $HOME/app
COPY --chown=pn backend backend
COPY --chown=pn nginx.conf /etc/nginx/sites-available/default
RUN ls -a
# Prepare the entrypoint scripts
COPY --chown=pn start_ollama.sh start_ollama.sh
COPY --chown=pn start_app.sh start_app.sh
RUN ls -a
RUN chmod +x start_ollama.sh
RUN chmod +x start_app.sh
# Expose the port 11434 for ollama, 8080 for the backend, and 8000 for FastAPI
EXPOSE 11434 8080 8000
CMD ["bash", "start_ollama.sh"] |