Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +22 -24
Dockerfile
CHANGED
|
@@ -3,34 +3,35 @@ FROM nikolaik/python-nodejs:python3.11-nodejs21
|
|
| 3 |
# Install nginx
|
| 4 |
USER root
|
| 5 |
RUN apt-get -y update && apt-get -y install nginx
|
| 6 |
-
|
| 7 |
# Setup directory structure for Nginx
|
| 8 |
RUN mkdir -p /var/cache/nginx \
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
| 13 |
RUN touch /var/run/nginx.pid && touch /var/log/nginx/error.log
|
| 14 |
|
| 15 |
# Give permissions to 'pn' user for Nginx and static files directory
|
| 16 |
RUN chown -R pn:pn /var/cache/nginx \
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
|
| 24 |
# Switch back to the 'pn' user for installing dependencies and building the app
|
| 25 |
USER pn
|
| 26 |
ENV HOME=/home/pn \
|
| 27 |
-
|
| 28 |
|
| 29 |
WORKDIR $HOME/app
|
| 30 |
|
| 31 |
# Copy the requirements and install Python dependencies
|
| 32 |
COPY --chown=pn requirements.txt requirements.txt
|
| 33 |
-
RUN pip install --no-cache-dir
|
| 34 |
|
| 35 |
# Handling frontend setup: Install dependencies and build
|
| 36 |
COPY --chown=pn frontend frontend
|
|
@@ -38,25 +39,22 @@ WORKDIR $HOME/app/frontend
|
|
| 38 |
RUN npm install
|
| 39 |
RUN npm run build && cp -r dist/. /usr/share/nginx/html && ls /usr/share/nginx/html
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
# Switch back to the app directory and setup the backend
|
| 44 |
-
|
| 45 |
WORKDIR $HOME/app
|
| 46 |
-
|
| 47 |
COPY --chown=pn backend backend
|
| 48 |
-
|
| 49 |
-
|
| 50 |
COPY --chown=pn nginx.conf /etc/nginx/sites-available/default
|
| 51 |
-
#COPY --chown=pn default.conf /etc/nginx/conf.d/default.conf
|
| 52 |
-
|
| 53 |
RUN ls -a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
# Prepare the entrypoint script
|
| 55 |
COPY --chown=pn run.sh run.sh
|
| 56 |
-
RUN ls -a
|
| 57 |
RUN chmod +x run.sh
|
| 58 |
|
| 59 |
-
# Expose the port 8080
|
| 60 |
-
EXPOSE 8080 8000
|
| 61 |
|
| 62 |
CMD ["bash", "run.sh"]
|
|
|
|
| 3 |
# Install nginx
|
| 4 |
USER root
|
| 5 |
RUN apt-get -y update && apt-get -y install nginx
|
| 6 |
+
|
| 7 |
# Setup directory structure for Nginx
|
| 8 |
RUN mkdir -p /var/cache/nginx \
|
| 9 |
+
/var/log/nginx \
|
| 10 |
+
/var/lib/nginx \
|
| 11 |
+
/var/www/html \
|
| 12 |
+
/usr/share/nginx/html
|
| 13 |
+
|
| 14 |
RUN touch /var/run/nginx.pid && touch /var/log/nginx/error.log
|
| 15 |
|
| 16 |
# Give permissions to 'pn' user for Nginx and static files directory
|
| 17 |
RUN chown -R pn:pn /var/cache/nginx \
|
| 18 |
+
/var/log/nginx \
|
| 19 |
+
/var/lib/nginx \
|
| 20 |
+
/var/run/nginx.pid \
|
| 21 |
+
/var/www/html \
|
| 22 |
+
/var/log/nginx/error.log \
|
| 23 |
+
/usr/share/nginx/html
|
| 24 |
|
| 25 |
# Switch back to the 'pn' user for installing dependencies and building the app
|
| 26 |
USER pn
|
| 27 |
ENV HOME=/home/pn \
|
| 28 |
+
PATH=/home/pn/.local/bin:$PATH
|
| 29 |
|
| 30 |
WORKDIR $HOME/app
|
| 31 |
|
| 32 |
# Copy the requirements and install Python dependencies
|
| 33 |
COPY --chown=pn requirements.txt requirements.txt
|
| 34 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 35 |
|
| 36 |
# Handling frontend setup: Install dependencies and build
|
| 37 |
COPY --chown=pn frontend frontend
|
|
|
|
| 39 |
RUN npm install
|
| 40 |
RUN npm run build && cp -r dist/. /usr/share/nginx/html && ls /usr/share/nginx/html
|
| 41 |
|
|
|
|
|
|
|
| 42 |
# Switch back to the app directory and setup the backend
|
|
|
|
| 43 |
WORKDIR $HOME/app
|
|
|
|
| 44 |
COPY --chown=pn backend backend
|
|
|
|
|
|
|
| 45 |
COPY --chown=pn nginx.conf /etc/nginx/sites-available/default
|
|
|
|
|
|
|
| 46 |
RUN ls -a
|
| 47 |
+
|
| 48 |
+
# Install ollama and pull the phi3 model
|
| 49 |
+
RUN curl -fsSL https://ollama.com/install.sh | sh
|
| 50 |
+
RUN ollama pull phi3
|
| 51 |
+
|
| 52 |
# Prepare the entrypoint script
|
| 53 |
COPY --chown=pn run.sh run.sh
|
| 54 |
+
RUN ls -a
|
| 55 |
RUN chmod +x run.sh
|
| 56 |
|
| 57 |
+
# Expose the port 8080 and 8000
|
| 58 |
+
EXPOSE 8080 8000
|
| 59 |
|
| 60 |
CMD ["bash", "run.sh"]
|