Spaces:
Paused
Paused
v0.1
Browse files- Dockerfile +42 -0
- entrypoint.sh +9 -0
- nginx.conf +77 -0
Dockerfile
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use the official NGINX image
|
| 2 |
+
FROM nginx:latest
|
| 3 |
+
|
| 4 |
+
#=================================================================
|
| 5 |
+
USER root
|
| 6 |
+
#=================================================================
|
| 7 |
+
|
| 8 |
+
RUN apt-get update && \
|
| 9 |
+
apt-get install -y git && \
|
| 10 |
+
apt-get clean && \
|
| 11 |
+
rm -rf /var/lib/apt/lists/*
|
| 12 |
+
|
| 13 |
+
RUN groupadd user && \
|
| 14 |
+
useradd -d /home/user -ms /bin/bash -g user -G user -p user user
|
| 15 |
+
|
| 16 |
+
COPY nginx.conf /etc/nginx/nginx.conf
|
| 17 |
+
|
| 18 |
+
RUN rm -rf /usr/share/nginx/html/* && \
|
| 19 |
+
chown -R user:user /usr/share/nginx/html
|
| 20 |
+
|
| 21 |
+
RUN mkdir -p /var/cache/nginx \
|
| 22 |
+
/var/log/nginx \
|
| 23 |
+
/var/lib/nginx && \
|
| 24 |
+
touch /var/run/nginx.pid && \
|
| 25 |
+
chown -R user:user /var/cache/nginx \
|
| 26 |
+
/var/log/nginx \
|
| 27 |
+
/var/lib/nginx \
|
| 28 |
+
/var/run/nginx.pid
|
| 29 |
+
|
| 30 |
+
#=================================================================
|
| 31 |
+
USER user
|
| 32 |
+
#=================================================================
|
| 33 |
+
ENV HOME=/home/user \
|
| 34 |
+
PATH=/home/user/.local/bin:$PATH
|
| 35 |
+
|
| 36 |
+
WORKDIR $HOME
|
| 37 |
+
|
| 38 |
+
COPY --chown=user:user --chmod=755 entrypoint.sh $HOME
|
| 39 |
+
|
| 40 |
+
EXPOSE 7860
|
| 41 |
+
|
| 42 |
+
ENTRYPOINT [ "./entrypoint.sh" ]
|
entrypoint.sh
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
git clone ${REPO_URL} /usr/share/nginx/html
|
| 4 |
+
|
| 5 |
+
service nginx start
|
| 6 |
+
while true
|
| 7 |
+
do
|
| 8 |
+
sleep 60
|
| 9 |
+
done
|
nginx.conf
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
events {}
|
| 2 |
+
|
| 3 |
+
http {
|
| 4 |
+
include mime.types;
|
| 5 |
+
default_type application/octet-stream;
|
| 6 |
+
|
| 7 |
+
server {
|
| 8 |
+
listen 7860;
|
| 9 |
+
server_name localhost;
|
| 10 |
+
|
| 11 |
+
root /usr/share/nginx/html;
|
| 12 |
+
|
| 13 |
+
location / {
|
| 14 |
+
index index.html;
|
| 15 |
+
try_files $uri $uri/ =404;
|
| 16 |
+
|
| 17 |
+
# On-disk Brotli-precompressed data files should be served with compression enabled:
|
| 18 |
+
location ~ .+\.(data|symbols\.json)\.br$ {
|
| 19 |
+
# Because this file is already pre-compressed on disk, disable the on-demand compression on it.
|
| 20 |
+
# Otherwise nginx would attempt double compression.
|
| 21 |
+
gzip off;
|
| 22 |
+
add_header Content-Encoding br;
|
| 23 |
+
default_type application/octet-stream;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
# On-disk Brotli-precompressed JavaScript code files:
|
| 27 |
+
location ~ .+\.js\.br$ {
|
| 28 |
+
gzip off; # Do not attempt dynamic gzip compression on an already compressed file
|
| 29 |
+
add_header Content-Encoding br;
|
| 30 |
+
default_type application/javascript;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
# On-disk Brotli-precompressed WebAssembly files:
|
| 34 |
+
location ~ .+\.wasm\.br$ {
|
| 35 |
+
gzip off; # Do not attempt dynamic gzip compression on an already compressed file
|
| 36 |
+
add_header Content-Encoding br;
|
| 37 |
+
# Enable streaming WebAssembly compilation by specifying the correct MIME type for
|
| 38 |
+
# Wasm files.
|
| 39 |
+
default_type application/wasm;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
# On-disk gzip-precompressed data files should be served with compression enabled:
|
| 43 |
+
location ~ .+\.(data|symbols\.json)\.gz$ {
|
| 44 |
+
gzip off; # Do not attempt dynamic gzip compression on an already compressed file
|
| 45 |
+
add_header Content-Encoding gzip;
|
| 46 |
+
default_type application/gzip;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
# On-disk gzip-precompressed JavaScript code files:
|
| 50 |
+
location ~ .+\.js\.gz$ {
|
| 51 |
+
gzip off; # Do not attempt dynamic gzip compression on an already compressed file
|
| 52 |
+
add_header Content-Encoding gzip; # The correct MIME type here would be application/octet-stream, but due to Safari bug https://bugs.webkit.org/show_bug.cgi?id=247421, it's preferable to use MIME Type application/gzip instead.
|
| 53 |
+
default_type application/javascript;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
# On-disk gzip-precompressed WebAssembly files:
|
| 57 |
+
location ~ .+\.wasm\.gz$ {
|
| 58 |
+
gzip off; # Do not attempt dynamic gzip compression on an already compressed file
|
| 59 |
+
add_header Content-Encoding gzip;
|
| 60 |
+
# Enable streaming WebAssembly compilation by specifying the correct MIME type for
|
| 61 |
+
# Wasm files.
|
| 62 |
+
default_type application/wasm;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
# Uncomment the following lines if build was created with "Enable Native C/C++ Multithreading" player settings
|
| 66 |
+
# location ~ .+\.(htm|html|js|js\.gz|js\.br)$ {
|
| 67 |
+
# add_header Cross-Origin-Opener-Policy same-origin;
|
| 68 |
+
# add_header Cross-Origin-Embedder-Policy require-corp;
|
| 69 |
+
# add_header Cross-Origin-Resource-Policy cross-origin;
|
| 70 |
+
# }
|
| 71 |
+
|
| 72 |
+
# Uncomment the following line to allow CORS requests
|
| 73 |
+
# add_header Access-Control-Allow-Origin *;
|
| 74 |
+
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
}
|