andreped commited on
Commit
a40c88c
·
2 Parent(s): 520c932 2990dcd

Merge pull request #2 from andreped/docker

Browse files

Containerized web app using Docker; configured nginx for deployment

Files changed (4) hide show
  1. Dockerfile +35 -0
  2. README.md +18 -1
  3. index.html +4 -4
  4. nginx.conf +16 -0
Dockerfile ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nginx:alpine
2
+
3
+ # Install shadow package to get useradd command
4
+ RUN apk add --no-cache shadow
5
+
6
+ # Install wget
7
+ RUN apk add --no-cache wget
8
+
9
+ # Add a new user
10
+ RUN useradd -m -u 1000 user
11
+
12
+ # Set the working directory
13
+ WORKDIR /app
14
+
15
+ # Copy the HTML and nginx configuration files
16
+ COPY index.html /usr/share/nginx/html
17
+ COPY nginx.conf /etc/nginx/nginx.conf
18
+
19
+ # Download test data
20
+ RUN wget https://github.com/andreped/wsi-visualization-demo/releases/download/sample-data/test-sample.zip \
21
+ && unzip test-sample.zip -d /usr/share/nginx/html \
22
+ && rm test-sample.zip
23
+
24
+ # Download OpenSeadragon
25
+ RUN wget https://github.com/openseadragon/openseadragon/releases/download/v5.0.0/openseadragon-bin-5.0.0.zip \
26
+ && unzip openseadragon-bin-5.0.0.zip -d /usr/share/nginx/html \
27
+ && rm openseadragon-bin-5.0.0.zip
28
+
29
+ RUN ls -la /usr/share/nginx/html
30
+
31
+ # Expose port 7860
32
+ EXPOSE 7860
33
+
34
+ # Start nginx as root but serve files as non-root user
35
+ CMD ["sh", "-c", "nginx -g 'daemon off;'"]
README.md CHANGED
@@ -1 +1,18 @@
1
- # fast-wsi-visualization
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # wsi-visualization-demo
2
+
3
+ ## Docker
4
+
5
+ 1. Build image:
6
+ ```
7
+ docker build -t wsi-visualization .
8
+ ```
9
+
10
+ 2. Run image:
11
+ ```
12
+ docker run -p 7860:7860 wsi-visualization
13
+ ```
14
+
15
+ 3. Open in browser:
16
+ ```
17
+ open http://localhost:7860
18
+ ```
index.html CHANGED
@@ -11,21 +11,21 @@
11
  </div>
12
  <div id="openseadragon1" style="float: right; width: 90%; height: 100%; background: black;"></div>
13
  </div>
14
- <script src="/Users/andreped/Downloads/openseadragon-bin-5.0.0/openseadragon.min.js"></script>
15
  <script type="text/javascript">
16
  var counter = 3;
17
  var viewer = OpenSeadragon({
18
  id: "openseadragon1",
19
- prefixUrl: "/Users/andreped/Downloads/openseadragon-bin-5.0.0/images/",
20
  tileSources: {
21
  Image: {
22
  xmlns: "http://schemas.microsoft.com/deepzoom/2008",
23
- Url: "/Users/andreped/workspace/PyWSIViewer/A05_files/",
24
  Format: "jpeg",
25
  Overlap: "0",
26
  TileSize: "256",
27
  Size: {
28
- Height: 42625,
29
  Width: 51553
30
  }
31
  },
 
11
  </div>
12
  <div id="openseadragon1" style="float: right; width: 90%; height: 100%; background: black;"></div>
13
  </div>
14
+ <script src="openseadragon-bin-5.0.0/openseadragon.min.js"></script>
15
  <script type="text/javascript">
16
  var counter = 3;
17
  var viewer = OpenSeadragon({
18
  id: "openseadragon1",
19
+ prefixUrl: "openseadragon-bin-5.0.0/images/",
20
  tileSources: {
21
  Image: {
22
  xmlns: "http://schemas.microsoft.com/deepzoom/2008",
23
+ Url: "A05_files/",
24
  Format: "jpeg",
25
  Overlap: "0",
26
  TileSize: "256",
27
  Size: {
28
+ Height: 42625,
29
  Width: 51553
30
  }
31
  },
nginx.conf ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ user user;
2
+ events {
3
+ worker_connections 1024;
4
+ }
5
+
6
+ http {
7
+ server {
8
+ listen 7860;
9
+ server_name localhost;
10
+
11
+ location / {
12
+ root /usr/share/nginx/html;
13
+ index index.html;
14
+ }
15
+ }
16
+ }