From b92a69db42d9d8ff0183be67470a4810eaf4f9a6 Mon Sep 17 00:00:00 2001 From: Lucas Li <35748253+yzlucas@users.noreply.github.com> Date: Tue, 1 Oct 2024 17:12:35 -0700 Subject: [PATCH 1/2] revert docker file (#129) --- client/wfprev-war/Dockerfile | 93 +++++++++++++++--------------------- 1 file changed, 39 insertions(+), 54 deletions(-) diff --git a/client/wfprev-war/Dockerfile b/client/wfprev-war/Dockerfile index 168851f8f..0b6d10d19 100644 --- a/client/wfprev-war/Dockerfile +++ b/client/wfprev-war/Dockerfile @@ -1,54 +1,39 @@ -# Use an official Tomcat image with JDK 8 -FROM tomcat:9.0.91-jdk17 - -#Install at very top layer to ease caching issues for devs -RUN apt-get -y update &&\ - apt-get install -y unzip - -ARG CONTAINER_NAME=wfprev-war - -ENV CATALINA_HOME /usr/local/tomcat - -# Define build arguments -ARG WAR_FILE=*.war -ARG CONTAINER_NAME - -# Add the application's war to the container and rename it to pub#.war -ADD ${WAR_FILE} . - -# Copy the context.xml.template template and other configuration files -# COPY docker-files/server.xml $CATALINA_HOME/conf/ - -# Create the tomcat user and group, and set permissions -# TEMPNAME step is to remove "-war" from the path -RUN rm -rf /usr/local/tomcat/webapps/ROOT &&\ - for i in $(ls *.war) ; \ - do \ - export TEMPNAME="$(echo $i | sed 's/(.*)((-api)|(-war))-.*/\1\3/' -r)" &&\ - unzip $i -d /usr/local/tomcat/webapps/pub#$TEMPNAME ; \ - done &&\ - addgroup --system tomcat &&\ - adduser --system --ingroup tomcat tomcat &&\ - chown -R tomcat:tomcat `readlink -f ${CATALINA_HOME}` &&\ - chmod -R 770 `readlink -f ${CATALINA_HOME}` &&\ - chown -h tomcat:tomcat ${CATALINA_HOME} &&\ - mkdir -p /usr/local/tomcat/temp &&\ - mkdir -p /usr/local/tomcat/logs/wfhr &&\ - mkdir -p /${CATALINA_HOME}/webapps/pub#${CONTAINER_NAME} &&\ - chown -R tomcat:tomcat /usr/local/tomcat/logs/wfhr &&\ - chmod 766 /usr/local/tomcat/logs &&\ - chmod 766 /usr/local/tomcat/logs/wfhr &&\ - chmod 766 /usr/local/tomcat/work &&\ - chmod 766 /usr/local/tomcat/temp &&\ - chmod 766 /${CATALINA_HOME}/webapps/pub#${CONTAINER_NAME} &&\ - echo org.apache.tomcat.util.digester.PROPERTY_SOURCE=org.apache.tomcat.util.digester.EnvironmentPropertySource >> /usr/local/tomcat/conf/catalina.properties - -VOLUME /usr/local/tomcat/logs /usr/local/tomcat/work /usr/local/tomcat/temp - -# Expose the ports -EXPOSE 8080 8000 - -USER tomcat - -# Run the Tomcat server with JPDA settings for remote debugging -CMD ["catalina.sh", "run"] \ No newline at end of file +#Step 1: Build the Angular app +FROM node:18 AS build + +WORKDIR /src/main/angular + +# Add NPM Token from build arguments for private registry authentication +# ARG NPM_TOKEN +# ARG PRIVATE_REGISTRY_AUTH +# RUN echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc +# RUN echo "//bwa.nrs.gov.bc.ca/int/artifactory/api/npm/nrs-virtual-npm/:_auth=${PRIVATE_REGISTRY_AUTH}" >> .npmrc + +# Copy the package.json and package-lock.json files +COPY src/main/angular/package*.json ./ + +# Clean the npm cache before installing dependencies +RUN npm cache clean --force + +# Remove node_modules and package-lock.json if they exist (optional cleanup) +RUN rm -rf node_modules package-lock.json + +# Install npm dependencies +RUN npm install + +# Copy the rest of the Angular project files +COPY src/main/angular ./ + +# Build the Angular project (use --configuration=production instead of --prod) +RUN npm run build --configuration=production + +# Step 2: Serve the app with nginx +FROM nginx:alpine + +# Copy the built Angular app to Nginx +COPY --from=build /src/main/angular/dist/wfprev/* /usr/share/nginx/html +# Expose port 80 +EXPOSE 80 + +# Start Nginx server +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file From 308a01e55b47ad39d1c872f967700a2fe81a1b39 Mon Sep 17 00:00:00 2001 From: Lucas Li <35748253+yzlucas@users.noreply.github.com> Date: Tue, 1 Oct 2024 17:25:24 -0700 Subject: [PATCH 2/2] turn off readyonly for now in ecs client --- terraform/ecs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/ecs.tf b/terraform/ecs.tf index b06b6c26a..fe0c5b264 100644 --- a/terraform/ecs.tf +++ b/terraform/ecs.tf @@ -141,7 +141,7 @@ resource "aws_ecs_task_definition" "wfprev_client" { container_definitions = jsonencode([ { essential = true - readonlyRootFilesystem = true + readonlyRootFilesystem = false name = var.client_container_name image = var.CLIENT_IMAGE cpu = var.WFPREV_CLIENT_CPU_UNITS