BinaryONe commited on
Commit
973c33a
·
1 Parent(s): 664dac8

InitialCommit -Modification in Dockerfile

Browse files
Dockerfile CHANGED
@@ -14,25 +14,27 @@ RUN apk update && \
14
  # Copy Flask application
15
  COPY ./FlaskWebApp /app/FlaskWebApp
16
  COPY ./requirements.txt /app/requirements.txt
17
- COPY ./start_pyapps_multirun.sh /app/start_pyapps_multirun.sh
18
 
19
  # Copy Angular build files to Nginx web directory
20
  ADD ./resources.tar /var/www/portfolio
21
 
22
  # Backup original nginx.conf and copy new one
23
- #RUN mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig
24
  COPY ./nginx.conf /etc/nginx/nginx.conf
 
 
25
  #COPY ./default.conf /etc/nginx/conf.d/default.conf
26
 
27
  # Python virtual environment
28
  RUN python3 -m venv /app/PyEnv && \
29
  /app/PyEnv/bin/pip install --upgrade pip && \
30
- /app/PyEnv/bin/pip install -r /app/requirements.txt && \
31
  chmod -R +x /app
32
 
33
- RUN mkdir -p /var/log/nginx /run/nginx && \
 
34
  chown -R app_user:nginx_admin /var/lib/nginx /var/log/nginx /app
35
 
36
  USER app_user
37
 
38
- CMD ["sh","-c","/app/start_pyapps_multirun.sh"]
 
14
  # Copy Flask application
15
  COPY ./FlaskWebApp /app/FlaskWebApp
16
  COPY ./requirements.txt /app/requirements.txt
17
+ COPY ./start_apps.sh /app/start_apps.sh
18
 
19
  # Copy Angular build files to Nginx web directory
20
  ADD ./resources.tar /var/www/portfolio
21
 
22
  # Backup original nginx.conf and copy new one
 
23
  COPY ./nginx.conf /etc/nginx/nginx.conf
24
+
25
+ #RUN mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig
26
  #COPY ./default.conf /etc/nginx/conf.d/default.conf
27
 
28
  # Python virtual environment
29
  RUN python3 -m venv /app/PyEnv && \
30
  /app/PyEnv/bin/pip install --upgrade pip && \
31
+ /app/PyEnv/bin/pip install --cached -r /app/requirements.txt && \
32
  chmod -R +x /app
33
 
34
+ RUN touch /app/flask.log && \
35
+ mkdir -p /var/log/nginx /run/nginx && \
36
  chown -R app_user:nginx_admin /var/lib/nginx /var/log/nginx /app
37
 
38
  USER app_user
39
 
40
+ CMD ["sh","-c","/app/start_apps.sh"]
nginx.conf CHANGED
@@ -24,7 +24,7 @@ http {
24
  default_type application/octet-stream;
25
 
26
  #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';
27
- log_format compact '$remote_addr - $time_local - "$request" - $status - "$http_referer"';
28
 
29
  #access_log off;
30
 
 
24
  default_type application/octet-stream;
25
 
26
  #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';
27
+ log_format compact '$remote_addr - $time_local - "$request" - $status';
28
 
29
  #access_log off;
30
 
start_pyapps_multirun.sh → start_apps.sh RENAMED
@@ -6,7 +6,7 @@
6
  source /app/PyEnv/bin/activate
7
  echo "* Starting application *PWD $(pwd)*"
8
  cd /app || { echo "Failed to change directory to /app"; exit 1; }
9
- python3 -u -m FlaskWebApp || { echo "Failed to start WebSSH application"; exit 1; }
10
  #python3 -u -m FlaskWebApp > /app/flask.log 2>&1
11
  ) &
12
  nginx -g "daemon off;" > /dev/stdout; #> /app/nginx.log 2>&1
 
6
  source /app/PyEnv/bin/activate
7
  echo "* Starting application *PWD $(pwd)*"
8
  cd /app || { echo "Failed to change directory to /app"; exit 1; }
9
+ python3 -u -m FlaskWebApp || { echo "Failed to start WebSSH application"; exit 1; } > /app/flask.log 2>&1
10
  #python3 -u -m FlaskWebApp > /app/flask.log 2>&1
11
  ) &
12
  nginx -g "daemon off;" > /dev/stdout; #> /app/nginx.log 2>&1