Ramses II
commited on
Commit
·
676bf15
1
Parent(s):
46649e0
auto msg
Browse files- .DS_Store +0 -0
- Dockerfile +10 -3
- entrypoint.sh +1 -1
- nginx.conf +12 -0
.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
Dockerfile
CHANGED
|
@@ -6,6 +6,7 @@ WORKDIR /app
|
|
| 6 |
# Copy the requirements file
|
| 7 |
COPY requirements.txt .
|
| 8 |
|
|
|
|
| 9 |
COPY public /app/public
|
| 10 |
|
| 11 |
# Switch to root user to install system packages and set permissions
|
|
@@ -22,10 +23,16 @@ COPY entrypoint.sh /app/entrypoint.sh
|
|
| 22 |
# Set the entrypoint script as executable
|
| 23 |
RUN chmod +x /app/entrypoint.sh
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
# Ensure Nginx has permissions to write to log directory
|
| 26 |
-
RUN
|
| 27 |
-
|
| 28 |
-
chown -R ${NB_UID}:${NB_GID} /var/log/nginx
|
| 29 |
|
| 30 |
# Set the permissions for the app directory to the existing user
|
| 31 |
RUN chown -R ${NB_UID}:${NB_GID} /app
|
|
|
|
| 6 |
# Copy the requirements file
|
| 7 |
COPY requirements.txt .
|
| 8 |
|
| 9 |
+
# Copy static files
|
| 10 |
COPY public /app/public
|
| 11 |
|
| 12 |
# Switch to root user to install system packages and set permissions
|
|
|
|
| 23 |
# Set the entrypoint script as executable
|
| 24 |
RUN chmod +x /app/entrypoint.sh
|
| 25 |
|
| 26 |
+
# Create necessary directories and set permissions for Nginx
|
| 27 |
+
RUN mkdir -p /var/lib/nginx/body /var/lib/nginx/fastcgi \
|
| 28 |
+
/var/lib/nginx/proxy /var/lib/nginx/scgi \
|
| 29 |
+
/var/lib/nginx/uwsgi /var/log/nginx \
|
| 30 |
+
&& chown -R ${NB_UID}:${NB_GID} /var/lib/nginx /var/log/nginx /var/run \
|
| 31 |
+
&& chmod 755 /var/lib/nginx
|
| 32 |
+
|
| 33 |
# Ensure Nginx has permissions to write to log directory
|
| 34 |
+
RUN touch /var/log/nginx/error.log /var/log/nginx/access.log \
|
| 35 |
+
&& chown -R ${NB_UID}:${NB_GID} /var/log/nginx
|
|
|
|
| 36 |
|
| 37 |
# Set the permissions for the app directory to the existing user
|
| 38 |
RUN chown -R ${NB_UID}:${NB_GID} /app
|
entrypoint.sh
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
# Start JupyterLab in the background
|
| 4 |
-
jupyter lab --port=${JUPYTERLAB_PORT} --no-browser --allow-root &
|
| 5 |
|
| 6 |
# Start Nginx in the foreground
|
| 7 |
nginx -g "daemon off;"
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
# Start JupyterLab in the background
|
| 4 |
+
jupyter lab --ip=0.0.0.0 --port=${JUPYTERLAB_PORT} --no-browser --allow-root --NotebookApp.base_url=/jupyter &
|
| 5 |
|
| 6 |
# Start Nginx in the foreground
|
| 7 |
nginx -g "daemon off;"
|
nginx.conf
CHANGED
|
@@ -15,12 +15,24 @@ http {
|
|
| 15 |
listen 7860;
|
| 16 |
server_name localhost;
|
| 17 |
|
|
|
|
| 18 |
location / {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
proxy_pass http://127.0.0.1:8888;
|
| 20 |
proxy_set_header Host $host;
|
| 21 |
proxy_set_header X-Real-IP $remote_addr;
|
| 22 |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 23 |
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
}
|
| 25 |
|
| 26 |
error_log /var/log/nginx/error.log;
|
|
|
|
| 15 |
listen 7860;
|
| 16 |
server_name localhost;
|
| 17 |
|
| 18 |
+
# Serve static files from /app/public
|
| 19 |
location / {
|
| 20 |
+
root /app/public;
|
| 21 |
+
try_files $uri $uri/ =404;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
# Proxy JupyterLab to /jupyter/
|
| 25 |
+
location /jupyter/ {
|
| 26 |
proxy_pass http://127.0.0.1:8888;
|
| 27 |
proxy_set_header Host $host;
|
| 28 |
proxy_set_header X-Real-IP $remote_addr;
|
| 29 |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 30 |
proxy_set_header X-Forwarded-Proto $scheme;
|
| 31 |
+
|
| 32 |
+
# WebSocket support
|
| 33 |
+
proxy_http_version 1.1;
|
| 34 |
+
proxy_set_header Upgrade $http_upgrade;
|
| 35 |
+
proxy_set_header Connection "upgrade";
|
| 36 |
}
|
| 37 |
|
| 38 |
error_log /var/log/nginx/error.log;
|