Loading docker-compose-dev.yml +11 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,17 @@ services: #volumes: # - ./services/api-gateway/opt/esap-api-gateway:/opt/opt/esap-api-gateway gui: image: "esap/gui" container_name: gui hostname: gui ports: - "8001:8001" #volumes: # - ./services/gui/opt/esap-gui:/opt/opt/esap-gui proxy: image: "esap/proxy" container_name: proxy Loading esap/build +1 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ if [[ "x$SERVICE" == "x" ]] ; then # Build all services $BUILD_COMMAND services/api-gateway -t esap/api-gateway $BUILD_COMMAND services/proxy -t esap/proxy $BUILD_COMMAND services/gui -t esap/gui else Loading services/gui/Dockerfile 0 → 100644 +71 −0 Original line number Diff line number Diff line FROM ubuntu:20.04 MAINTAINER Stefano Alberto Russo <stefano.russo@gmail.com> #---------------------- # Basics #---------------------- # Set non-interactive ENV DEBIAN_FRONTEND noninteractive # Update RUN apt-get update # Utilities RUN apt-get install -y nano telnet unzip wget openssh-server sudo curl # Devel RUN apt-get install -y build-essential python-dev git-core # Node & nginx RUN apt-get install -y nodejs npm nginx #------------------------ # Esap user #------------------------ # Add group. We chose GID 65527 to try avoiding conflicts. RUN groupadd -g 65527 esap # Add user. We chose UID 65527 to try avoiding conflicts. RUN useradd esap -d /esap -u 65527 -g 65527 -m -s /bin/bash # Add esap user to sudoers RUN adduser esap sudo # No pass sudo (for everyone, actually) COPY sudoers /etc/sudoers #------------------------ # Code #------------------------ RUN cd /opt && git clone https://git.astron.nl/astron-sdc/esap-gui.git RUN cd /opt/esap-gui && git pull && git checkout 0be8125b478007c75b13002d4e5273af7e14c057 RUN cd /opt/esap-gui && npm install RUN cd /opt/esap-gui && npm run build # Link static files RUN ln -s /opt/esap-gui/build /var/www/html/esap-gui RUN ln -s /opt/esap-gui/build/static/ /var/www/html/static # Change nginx conf to listen on 8001 COPY sites_enabled_default /etc/nginx/sites-enabled/default # Add redirect index COPY index.html /var/www/html/index.html #---------------------- # Entrypoint #---------------------- COPY run_gui.sh /run_gui.sh COPY entrypoint.sh /entrypoint.sh RUN chmod 755 /entrypoint.sh /run_gui.sh USER esap ENTRYPOINT ["/entrypoint.sh"] services/gui/entrypoint.sh 0 → 100644 +40 −0 Original line number Diff line number Diff line #!/bin/bash # Exit on any error. set -e echo "" echo "[INFO] Executing entrypoint..." #--------------------- # Save env #--------------------- echo "[INFO] Dumping env" # Save env vars for later usage (e.g. docker exec) env | \ while read env_var; do if [[ $env_var == HOME\=* ]]; then : # Skip HOME var elif [[ $env_var == PWD\=* ]]; then : # Skip PWD var else echo "export $env_var" >> /tmp/env.sh fi done #--------------------- # Entrypoint command #--------------------- if [[ "x$@" == "x" ]] ; then ENTRYPOINT_COMMAND="/run_gui.sh" else ENTRYPOINT_COMMAND=$@ fi echo -n "[INFO] Executing Docker entrypoint command: " echo $ENTRYPOINT_COMMAND exec "$ENTRYPOINT_COMMAND" services/gui/index.html 0 → 100644 +6 −0 Original line number Diff line number Diff line <html> <head> <meta http-equiv="refresh" content="0; URL=/esap-gui" /> </head> </html> No newline at end of file Loading
docker-compose-dev.yml +11 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,17 @@ services: #volumes: # - ./services/api-gateway/opt/esap-api-gateway:/opt/opt/esap-api-gateway gui: image: "esap/gui" container_name: gui hostname: gui ports: - "8001:8001" #volumes: # - ./services/gui/opt/esap-gui:/opt/opt/esap-gui proxy: image: "esap/proxy" container_name: proxy Loading
esap/build +1 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ if [[ "x$SERVICE" == "x" ]] ; then # Build all services $BUILD_COMMAND services/api-gateway -t esap/api-gateway $BUILD_COMMAND services/proxy -t esap/proxy $BUILD_COMMAND services/gui -t esap/gui else Loading
services/gui/Dockerfile 0 → 100644 +71 −0 Original line number Diff line number Diff line FROM ubuntu:20.04 MAINTAINER Stefano Alberto Russo <stefano.russo@gmail.com> #---------------------- # Basics #---------------------- # Set non-interactive ENV DEBIAN_FRONTEND noninteractive # Update RUN apt-get update # Utilities RUN apt-get install -y nano telnet unzip wget openssh-server sudo curl # Devel RUN apt-get install -y build-essential python-dev git-core # Node & nginx RUN apt-get install -y nodejs npm nginx #------------------------ # Esap user #------------------------ # Add group. We chose GID 65527 to try avoiding conflicts. RUN groupadd -g 65527 esap # Add user. We chose UID 65527 to try avoiding conflicts. RUN useradd esap -d /esap -u 65527 -g 65527 -m -s /bin/bash # Add esap user to sudoers RUN adduser esap sudo # No pass sudo (for everyone, actually) COPY sudoers /etc/sudoers #------------------------ # Code #------------------------ RUN cd /opt && git clone https://git.astron.nl/astron-sdc/esap-gui.git RUN cd /opt/esap-gui && git pull && git checkout 0be8125b478007c75b13002d4e5273af7e14c057 RUN cd /opt/esap-gui && npm install RUN cd /opt/esap-gui && npm run build # Link static files RUN ln -s /opt/esap-gui/build /var/www/html/esap-gui RUN ln -s /opt/esap-gui/build/static/ /var/www/html/static # Change nginx conf to listen on 8001 COPY sites_enabled_default /etc/nginx/sites-enabled/default # Add redirect index COPY index.html /var/www/html/index.html #---------------------- # Entrypoint #---------------------- COPY run_gui.sh /run_gui.sh COPY entrypoint.sh /entrypoint.sh RUN chmod 755 /entrypoint.sh /run_gui.sh USER esap ENTRYPOINT ["/entrypoint.sh"]
services/gui/entrypoint.sh 0 → 100644 +40 −0 Original line number Diff line number Diff line #!/bin/bash # Exit on any error. set -e echo "" echo "[INFO] Executing entrypoint..." #--------------------- # Save env #--------------------- echo "[INFO] Dumping env" # Save env vars for later usage (e.g. docker exec) env | \ while read env_var; do if [[ $env_var == HOME\=* ]]; then : # Skip HOME var elif [[ $env_var == PWD\=* ]]; then : # Skip PWD var else echo "export $env_var" >> /tmp/env.sh fi done #--------------------- # Entrypoint command #--------------------- if [[ "x$@" == "x" ]] ; then ENTRYPOINT_COMMAND="/run_gui.sh" else ENTRYPOINT_COMMAND=$@ fi echo -n "[INFO] Executing Docker entrypoint command: " echo $ENTRYPOINT_COMMAND exec "$ENTRYPOINT_COMMAND"
services/gui/index.html 0 → 100644 +6 −0 Original line number Diff line number Diff line <html> <head> <meta http-equiv="refresh" content="0; URL=/esap-gui" /> </head> </html> No newline at end of file