Skip to content

Commit

Permalink
Merge pull request #159 from ssylver93/feature/WFPREV-44
Browse files Browse the repository at this point in the history
Feature/wfprev 44
  • Loading branch information
ssylver93 authored Oct 8, 2024
2 parents a9514d1 + f299ae9 commit 50ebd7c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 54 deletions.
44 changes: 15 additions & 29 deletions server/wfprev-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,44 +1,30 @@
# Use an official Tomcat image as a base image
FROM tomcat:10.1-jdk17-corretto

# Install unzip at the top layer to ease caching issues for devs
RUN yum update -y && \
yum install -y unzip && \
yum clean all
# Remove the default webapps to avoid conflicts
RUN rm -rf /usr/local/tomcat/webapps/*

# Define build arguments
ARG WAR_FILE=*.war
ARG CONTAINER_NAME=wfprev-api
ARG CONTAINER_NAME=wfprev-war
ENV CATALINA_HOME /usr/local/tomcat

# Set environment variables
ENV CATALINA_HOME=/usr/local/tomcat \
# Copy the WAR file to the Tomcat webapps directory with the new name
COPY target/wfprev-api-1.0.0-SNAPSHOT.war /usr/local/tomcat/webapps/pub#wfprev-api.war

ENV TOMCAT_HOME=/usr/local/tomcat \
CATALINA_HOME=/usr/local/tomcat \
CATALINA_OUT=/usr/local/tomcat/logs \
TOMCAT_MAJOR=10 \
JAVA_OPTS="$JAVA_OPTS -Xss200k"

# Add WAR file
ADD ${WAR_FILE} .

# Set up directories and permissions
RUN rm -rf /usr/local/tomcat/webapps/ROOT && \
for i in $(ls *.war); do \
export TEMPNAME="$(echo $i | sed -E 's/(.*)((-api)|(-war))-.*/\1\3/')" && \
unzip $i -d /usr/local/tomcat/webapps/pub#$TEMPNAME; \
done && \
chmod -R 770 ${CATALINA_HOME} && \
mkdir -p /usr/local/tomcat/temp && \
mkdir -p ${CATALINA_HOME}/webapps/pub#${CONTAINER_NAME} && \
chmod 766 /usr/local/tomcat/logs && \
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

# Define volumes for logs, work, and temp directories
VOLUME /usr/local/tomcat/logs /usr/local/tomcat/work /usr/local/tomcat/temp
# Set permissions for logs, work, and temp directories
RUN chmod 766 /usr/local/tomcat/logs && chmod 766 /usr/local/tomcat/work && chmod 766 /usr/local/tomcat/temp

# Define volumes for logs, work, temp, and webapps directories
VOLUME /usr/local/tomcat/logs /usr/local/tomcat/work /usr/local/tomcat/temp /usr/local/tomcat/webapps

# Expose the Tomcat port (default is 8080)
EXPOSE 8080

# Start Tomcat when the container
# Start Tomcat when the container starts
CMD ["catalina.sh", "run"]
54 changes: 29 additions & 25 deletions server/wfprev-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
</scm>
<properties>
<java.version>17</java.version>
<jersey.version>3.1.3</jersey.version>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -115,11 +114,6 @@
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
Expand All @@ -131,18 +125,6 @@
<scope>test</scope>
</dependency>

<!-- Jersey -->
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring6</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>${jersey.version}</version>
</dependency>

<!-- Common Software Framework -->
<dependency>
<groupId>ca.bc.gov.nrs.wfone.common</groupId>
Expand Down Expand Up @@ -193,6 +175,16 @@
<groupId>ca.bc.gov.nrs.wfone.common</groupId>
<artifactId>wfone-common-rest-endpoints</artifactId>
<version>1.4.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2</artifactId>
</exclusion>
<exclusion>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2-servlet-initializer-v2</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>ca.bc.gov.nrs.wfone.common</groupId>
Expand All @@ -204,17 +196,11 @@
<artifactId>wfone-common-checkhealth</artifactId>
<version>1.4.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations-jakarta</artifactId>
<version>2.2.22</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-core-jakarta</artifactId>
<version>2.2.22</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
Expand All @@ -225,6 +211,24 @@
<artifactId>sonar-maven-plugin</artifactId>
<version>4.0.0.4121</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring6</artifactId>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -330,4 +334,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

0 comments on commit 50ebd7c

Please sign in to comment.