Spaces:
Running
Running
Configured docker file for deployment
Browse files- Dockerfile +38 -0
Dockerfile
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM nginx:alpine
|
| 2 |
+
|
| 3 |
+
# Install necessary packages
|
| 4 |
+
RUN apk add --no-cache shadow wget unzip nodejs npm
|
| 5 |
+
|
| 6 |
+
# Add a new user
|
| 7 |
+
RUN useradd -m -u 1000 user
|
| 8 |
+
|
| 9 |
+
# Set the working directory
|
| 10 |
+
WORKDIR /app
|
| 11 |
+
|
| 12 |
+
# Copy relevant files from repo for configuration and deployment
|
| 13 |
+
COPY index.html /usr/share/nginx/html
|
| 14 |
+
COPY nginx.conf /etc/nginx/nginx.conf
|
| 15 |
+
COPY package.json /app/package.json
|
| 16 |
+
|
| 17 |
+
# Download and uncompress test data
|
| 18 |
+
RUN wget https://github.com/andreped/wsi-visualization-demo/releases/download/sample-data/test-sample.zip \
|
| 19 |
+
&& unzip test-sample.zip -d /usr/share/nginx/html \
|
| 20 |
+
&& rm test-sample.zip
|
| 21 |
+
|
| 22 |
+
# Install npm dependencies
|
| 23 |
+
RUN cd /app && npm install
|
| 24 |
+
|
| 25 |
+
# Copy the installed dependencies to the nginx html directory
|
| 26 |
+
RUN cp -r node_modules/ /usr/share/nginx/html
|
| 27 |
+
|
| 28 |
+
# Change ownership of nginx directories to the new user
|
| 29 |
+
RUN chown -R user:user /var/cache/nginx /var/run /var/log/nginx /usr/share/nginx/html
|
| 30 |
+
|
| 31 |
+
# Expose port 7860
|
| 32 |
+
EXPOSE 7860
|
| 33 |
+
|
| 34 |
+
# Switch to the new user
|
| 35 |
+
USER user
|
| 36 |
+
|
| 37 |
+
# Start nginx
|
| 38 |
+
CMD ["nginx", "-g", "daemon off;"]
|