Raymond Weitekamp commited on
Commit
9330762
·
1 Parent(s): 7eb3a7a

Simplify Nginx setup and remove build-time testing

Browse files
Files changed (2) hide show
  1. Dockerfile +3 -44
  2. start.sh +1 -9
Dockerfile CHANGED
@@ -31,14 +31,11 @@ ENV OCP_VSCODE_LOCK_DIR=/tmp/ocpvscode
31
  COPY . .
32
 
33
  # Set up startup script with correct permissions
34
- RUN chmod +x start.sh test_nginx.sh
35
 
36
  # Configure Nginx with proper permissions
37
  RUN mkdir -p /var/lib/nginx/body && \
38
- mkdir -p /var/lib/nginx/fastcgi && \
39
  mkdir -p /var/lib/nginx/proxy && \
40
- mkdir -p /var/lib/nginx/scgi && \
41
- mkdir -p /var/lib/nginx/uwsgi && \
42
  mkdir -p /run/nginx && \
43
  chown -R www-data:www-data /var/lib/nginx && \
44
  chown -R www-data:www-data /var/log/nginx && \
@@ -49,7 +46,7 @@ RUN mkdir -p /var/lib/nginx/body && \
49
  chmod -R 755 /run/nginx && \
50
  rm -f /etc/nginx/sites-enabled/default
51
 
52
- # Create test nginx configuration
53
  RUN echo 'worker_processes 1;\n\
54
  error_log stderr info;\n\
55
  pid /run/nginx/nginx.pid;\n\
@@ -80,49 +77,11 @@ http {\n\
80
  proxy_set_header Upgrade $http_upgrade;\n\
81
  proxy_set_header Connection "upgrade";\n\
82
  proxy_set_header Host $host;\n\
 
83
  }\n\
84
  }\n\
85
  }' > /etc/nginx/nginx.conf
86
 
87
- # Create a test script for build-time verification
88
- RUN echo '#!/bin/bash\n\
89
- echo "Starting test server on port 7861..."\n\
90
- python3 -m http.server 7861 &\n\
91
- SERVER_PID=$!\n\
92
- \n\
93
- echo "Starting test server on port 3939..."\n\
94
- python3 -m http.server 3939 &\n\
95
- VIEWER_PID=$!\n\
96
- \n\
97
- echo "Starting nginx..."\n\
98
- nginx -g "daemon off;" &\n\
99
- NGINX_PID=$!\n\
100
- \n\
101
- echo "Waiting for servers to start..."\n\
102
- sleep 2\n\
103
- \n\
104
- echo "Testing main app proxy..."\n\
105
- MAIN_STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:7860/)\n\
106
- echo "Main app status: $MAIN_STATUS"\n\
107
- \n\
108
- echo "Testing viewer proxy..."\n\
109
- VIEWER_STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:7860/proxy/3939/viewer)\n\
110
- echo "Viewer status: $VIEWER_STATUS"\n\
111
- \n\
112
- kill $NGINX_PID\n\
113
- kill $SERVER_PID $VIEWER_PID\n\
114
- \n\
115
- if [ "$MAIN_STATUS" = "200" ] && [ "$VIEWER_STATUS" = "200" ]; then\n\
116
- echo "All tests passed!"\n\
117
- exit 0\n\
118
- else\n\
119
- echo "Tests failed!"\n\
120
- exit 1\n\
121
- fi' > /code/test_build.sh && chmod +x /code/test_build.sh
122
-
123
- # Run the build-time test
124
- RUN /code/test_build.sh
125
-
126
  # Create a non-root user and set up home directory
127
  RUN useradd -m -d /home/appuser -s /bin/bash appuser && \
128
  touch /home/appuser/.ocpvscode && \
 
31
  COPY . .
32
 
33
  # Set up startup script with correct permissions
34
+ RUN chmod +x start.sh
35
 
36
  # Configure Nginx with proper permissions
37
  RUN mkdir -p /var/lib/nginx/body && \
 
38
  mkdir -p /var/lib/nginx/proxy && \
 
 
39
  mkdir -p /run/nginx && \
40
  chown -R www-data:www-data /var/lib/nginx && \
41
  chown -R www-data:www-data /var/log/nginx && \
 
46
  chmod -R 755 /run/nginx && \
47
  rm -f /etc/nginx/sites-enabled/default
48
 
49
+ # Create nginx configuration for port forwarding
50
  RUN echo 'worker_processes 1;\n\
51
  error_log stderr info;\n\
52
  pid /run/nginx/nginx.pid;\n\
 
77
  proxy_set_header Upgrade $http_upgrade;\n\
78
  proxy_set_header Connection "upgrade";\n\
79
  proxy_set_header Host $host;\n\
80
+ proxy_read_timeout 86400;\n\
81
  }\n\
82
  }\n\
83
  }' > /etc/nginx/nginx.conf
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  # Create a non-root user and set up home directory
86
  RUN useradd -m -d /home/appuser -s /bin/bash appuser && \
87
  touch /home/appuser/.ocpvscode && \
start.sh CHANGED
@@ -1,12 +1,5 @@
1
  #!/bin/bash
2
 
3
- # Run Nginx tests
4
- echo "Running Nginx tests..."
5
- if ! ./test_nginx.sh; then
6
- echo "Nginx tests failed. Check permissions and configuration."
7
- exit 1
8
- fi
9
-
10
  # Create required directories with correct permissions
11
  mkdir -p /var/log/nginx
12
  chmod 777 /var/log/nginx
@@ -15,8 +8,7 @@ chmod 666 /var/log/nginx/error.log
15
  touch /var/log/nginx/access.log
16
  chmod 666 /var/log/nginx/access.log
17
 
18
- # Start Nginx without user directive
19
- sed -i 's/^user/#user/' /etc/nginx/nginx.conf
20
  nginx
21
 
22
  # Start the application on port 7861 (Nginx will proxy from 7860)
 
1
  #!/bin/bash
2
 
 
 
 
 
 
 
 
3
  # Create required directories with correct permissions
4
  mkdir -p /var/log/nginx
5
  chmod 777 /var/log/nginx
 
8
  touch /var/log/nginx/access.log
9
  chmod 666 /var/log/nginx/access.log
10
 
11
+ # Start Nginx
 
12
  nginx
13
 
14
  # Start the application on port 7861 (Nginx will proxy from 7860)