From 447b5482fb808f93bc863091e392ec62606b3d72 Mon Sep 17 00:00:00 2001
From: lb584 <lb584@cam.ac.uk>
Date: Thu, 12 Jan 2023 11:53:50 +0000
Subject: [PATCH] updating docker config files so they work in the new IaaS
 machine

---
 configs/docker/build/Dockerfile    | 18 +++++++++++++++---
 configs/docker/run/runDockerEWS.sh |  2 +-
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/configs/docker/build/Dockerfile b/configs/docker/build/Dockerfile
index 696ba0b..d1507f2 100644
--- a/configs/docker/build/Dockerfile
+++ b/configs/docker/build/Dockerfile
@@ -1,12 +1,14 @@
 # syntax=docker/dockerfile:1
 FROM ubuntu:18.04 as base_image
 
-#create dirs
-WORKDIR /home
-RUN mkdir /home/code
+#run mkdir as root
 RUN mkdir -p /storage/app/EWS_prod/regions/EastAfrica/workspace
 RUN mkdir -p /storage/app/EWS_prod/regions/SouthAsia/workspace
 
+#create dirs
+WORKDIR /home
+#RUN mkdir /home/ewsmanager/code
+
 #copy resources in
 COPY ./conda-env-py3EWS-withbuilds.yml .
 
@@ -28,3 +30,13 @@ RUN conda env create --file conda-env-py3EWS-withbuilds.yml --prefix /storage/ap
 
 #tidy
 RUN rm -v ~/miniconda.sh conda-env-py3EWS-withbuilds.yml;
+
+#these usernames and ids match the production server (IaaS), override when building a local image if needed
+ARG GNAME=ews
+ARG UNAME=ewsmanager
+ARG UID=1006
+ARG GID=1008
+RUN groupadd -g $GID $GNAME
+RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME
+USER ewsmanager
+WORKDIR /home/ewsmanager
diff --git a/configs/docker/run/runDockerEWS.sh b/configs/docker/run/runDockerEWS.sh
index aa8a64d..3fd000d 100755
--- a/configs/docker/run/runDockerEWS.sh
+++ b/configs/docker/run/runDockerEWS.sh
@@ -26,7 +26,7 @@ do
       shift 2
       ;;
     -h | --help)
-      "This is a launch script, example usage:\nrunDockerEWS.sh -p Deposition -c -c /<path>/config_EastAfrica_fc_live.json -s 20220808"
+      "This is a launch script, example usage: runDockerEWS.sh -p Deposition -c -c /<path>/config_EastAfrica_fc_live.json -s 20220808"
       exit 2
       ;;
     --)
-- 
GitLab