-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
single multistage Dockerfile for dashboard
- Loading branch information
1 parent
a86256a
commit 6c60b2f
Showing
10 changed files
with
213 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# GLOBAL ARGS: | ||
ARG DOCKER_KAFKA_HOST | ||
ARG DASHBOARD_BRANCH | ||
# for front-end | ||
ARG API_BASE_URL | ||
ARG SOCKET_URL | ||
# for backend: | ||
ARG BASKERVILLE_BRANCH | ||
ARG REDIS_HOST | ||
|
||
#FROM nginx:1.17.1-alpine AS NGINX | ||
FROM node:14.8.0-alpine AS FRONTEND | ||
ARG DASHBOARD_BRANCH | ||
ARG API_BASE_URL | ||
ARG SOCKET_URL | ||
|
||
ENV DASHBOARD_BRANCH $DASHBOARD_BRANCH | ||
ENV API_BASE_URL $API_BASE_URL | ||
ENV SOCKET_URL $SOCKET_URL | ||
|
||
RUN apk update \ | ||
# && apk upgrade \ | ||
&& apk add git \ | ||
&& mkdir /app && cd /app \ | ||
&& git clone --branch $DASHBOARD_BRANCH https://github.com/deflect-ca/baskerville_dashboard.git \ | ||
&& cd baskerville_dashboard/front-end \ | ||
&& npm install \ | ||
&& npm install -g @angular/[email protected] | ||
|
||
RUN echo $SOCKET_URL, $API_BASE_URL && echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" | ||
|
||
# this builds the front-end with provided configuration and copies the result in /var/www for nginx | ||
RUN cd /app/baskerville_dashboard/front-end \ | ||
&& npm run config \ | ||
&& ng build --prod | ||
|
||
FROM openjdk:8 AS OJDK8 | ||
FROM python:3.6 AS BACKEND | ||
|
||
ARG DOCKER_KAFKA_HOST | ||
ARG BASKERVILLE_BRANCH | ||
ARG DASHBOARD_BRANCH | ||
ARG REDIS_HOST | ||
|
||
ENV DOCKER_KAFKA_HOST $DOCKER_KAFKA_HOST | ||
ENV DASHBOARD_BRANCH $DASHBOARD_BRANCH | ||
ENV BASKERVILLE_BRANCH $BASKERVILLE_BRANCH | ||
ENV REDIS_HOST $REDIS_HOST | ||
ENV BASKERVILLE_ROOT '/app/baskerville' | ||
ENV BASKERVILLE_DASH_ROOT '/app/baskerville_dashboard' | ||
|
||
|
||
# Get jdk8 from previous stage https://docs.docker.com/develop/develop-images/multistage-build/ | ||
COPY --from=OJDK8 /usr/local/openjdk-8 /usr/local/openjdk-8 | ||
COPY --from=FRONTEND /app/baskerville_dashboard/front-end/dist/baskerville_dashboard_frontend/ /var/www/baskerville_dashboard_frontend/ | ||
|
||
# Set java path | ||
ENV JAVA_HOME /usr/local/openjdk-8 | ||
ENV PATH $PATH:$JAVA_HOME/bin | ||
|
||
# TODO: The following installs spark-iforest, esretriever and baskerville | ||
# which takes a long time - mostly because of the different pyspark versions. | ||
RUN apt-get clean && apt-get update \ | ||
# && apt-get -y upgrade \ | ||
&& apt-get install -y nginx=1.18.* \ | ||
&& apt-get install git \ | ||
&& pip install --upgrade pip \ | ||
&& mkdir /app && cd /app \ | ||
&& git clone https://github.com/titicaca/spark-iforest.git \ | ||
&& cd spark-iforest/python \ | ||
&& pip install . \ | ||
&& cd /app \ | ||
&& git clone https://github.com/equalitie/esretriever.git \ | ||
&& cd esretriever \ | ||
&& pip install . \ | ||
&& cd /app \ | ||
&& git clone --branch $BASKERVILLE_BRANCH https://github.com/deflect-ca/baskerville.git \ | ||
&& cd baskerville \ | ||
&& pip install . \ | ||
&& cd /app \ | ||
&& git clone --branch $DASHBOARD_BRANCH https://github.com/deflect-ca/baskerville_dashboard.git \ | ||
&& cd baskerville_dashboard/backend \ | ||
&& pip install . \ | ||
&& cd /app/baskerville_dashboard/backend/src/baskerville_dashboard | ||
|
||
# copy all related configurations | ||
COPY ./nginx.conf /etc/nginx/nginx.conf | ||
COPY ./config.yaml /app/baskerville_dashboard/backend/conf | ||
COPY ./baskerville.yaml /app/baskerville_dashboard/backend/conf | ||
|
||
WORKDIR /app/baskerville_dashboard/backend/src/baskerville_dashboard | ||
|
||
# socketio for Python includes a production grade web server. | ||
# start.sh starts nginx and runs dashboard backend. | ||
COPY start.sh start.sh | ||
CMD ["sh", "./start.sh"] | ||
EXPOSE 80 81 5000 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
events{} | ||
http { | ||
include /etc/nginx/mime.types; | ||
server { | ||
listen 80; | ||
server_name _; | ||
server_name localhost; | ||
|
||
location / { | ||
root /var/www/baskerville_dashboard_frontend/; | ||
index index.html; | ||
} | ||
location /api { | ||
rewrite ^/api/(.*) /$1 break; | ||
proxy_pass http://127.0.0.1:5000; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP ip_address; | ||
} | ||
|
||
location /socket.io { | ||
include proxy_params; | ||
proxy_http_version 1.1; | ||
proxy_buffering off; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "Upgrade"; | ||
proxy_pass http://127.0.0.1:5000/socket.io; | ||
} | ||
# location /api { | ||
# rewrite ^/api/(.*) /$1 break; | ||
# proxy_pass http://127.0.0.0:5000; | ||
# proxy_set_header Host $host; | ||
# proxy_set_header X-Real-IP ip_address; | ||
# } | ||
# location ~* \.io { | ||
# proxy_set_header X-Real-IP $remote_addr; | ||
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
# proxy_set_header Host $http_host; | ||
# proxy_set_header X-NginX-Proxy false; | ||
# | ||
# proxy_pass http://127.0.0.0:5000; | ||
# proxy_redirect off; | ||
# | ||
# proxy_http_version 1.1; | ||
# proxy_set_header Upgrade $http_upgrade; | ||
# proxy_set_header Connection "upgrade"; | ||
# } | ||
|
||
} | ||
|
||
# server { | ||
# listen 81; | ||
# server_name "dashboard_backend"; | ||
# # server_name $hostname; | ||
# location /api { | ||
# rewrite ^/api/(.*) /$1 break; | ||
# proxy_pass http://localhost:5000; | ||
# proxy_set_header Host $host; | ||
# proxy_set_header X-Real-IP ip_address; | ||
# } | ||
# location ~* \.io { | ||
# proxy_set_header X-Real-IP $remote_addr; | ||
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
# proxy_set_header Host $http_host; | ||
# proxy_set_header X-NginX-Proxy false; | ||
# | ||
# proxy_pass http://localhost:5000; | ||
# proxy_redirect off; | ||
# | ||
# proxy_http_version 1.1; | ||
# proxy_set_header Upgrade $http_upgrade; | ||
# proxy_set_header Connection "upgrade"; | ||
# } | ||
# | ||
# } | ||
# include /etc/nginx/sites.d/*.conf; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nginx && python app.py |
Oops, something went wrong.