Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding domain with sso #45

Open
wants to merge 5 commits into
base: CF-3592-EC2-Image-Builder
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 38 additions & 21 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

# use below command to build image
# docker build -t khannakavish/cloudfeeds-catalog:v4 -f Dockerfile --build-arg SCHEMA_VERSION=1.138.3-SNAPSHOT --build-arg saxon_lic=saxon-license.lic ../
# docker build -t catalog:v1 -f Dockerfile --build-arg SCHEMA_VERSION=1.138.3-SNAPSHOT ../

# =============== Clone Cloudfeeds-atomhopper repo to build container image in AWS EC2 Image Builder ===============
FROM bitnami/git:latest AS fetcher

ARG GIT_URL=https://github.com/rackerlabs/cloudfeeds-catalog.git
ARG git_url=https://github.com/rackerlabs/cloudfeeds-catalog.git

# ARG GIT_BRANCH="feature_containerization"
ARG GIT_BRANCH="CF-3592-EC2-Image-Builder"
ARG git_branch="AWS-Migration"

ENV GIT_URL=${GIT_URL:-$git_url} \
GIT_BRANCH=${GIT_BRANCH:-$git_branch}

RUN mkdir -p /home/cl && \
cd /home && \
Expand All @@ -20,12 +24,13 @@ RUN mkdir -p /home/cl && \

FROM maven:3.8.6-openjdk-8-slim AS builder

LABEL Maintainer="cloudfeeds-core@rackspace.com" \
description="Docker image for Cloudfeeds Catalog" \
NAME="cloudfeeds-catalog"
LABEL com.rackspace.cloudfeeds.image.maintainer="cloudfeeds-core@rackspace.com" \
com.rackspace.cloudfeeds.image.description="Container image for Cloudfeeds Catalog" \
com.rackspace.cloudfeeds.image.name="catalog" \
com.rackspace.cloudfeeds.image.source="https://github.com/rackerlabs/cloudfeeds-catalog"

WORKDIR /cf-catalog
COPY --from=fetcher /home/cl/pom.xml /cf-catalog/pom.xml
COPY --from=fetcher /home/cl/pom.xml /cf-catalog/pom.xml

# RUN mvn -e -B dependency:resolve
RUN mvn dependency:go-offline
Expand All @@ -39,9 +44,11 @@ RUN mvn -B verify
# Multi stage build
# Download artifacts

FROM alpine:3.18.3 as package
FROM alpine:3 as package

ARG schema_version="1.138.3-SNAPSHOT"

ARG SCHEMA_VERSION="1.138.3-SNAPSHOT"
ENV SCHEMA_VERSION=${SCHEMA_VERSION:-$schema_version}

#RUN apk add --update --no-cache curl tar ca-certificates && \
RUN apk add --update --no-cache curl tar && \
Expand All @@ -54,43 +61,53 @@ FROM tomcat:9-jre8 as tomcat

ARG service_port=8080
ARG saxon_lic
ARG SCHEMA_VERSION="1.138.3-SNAPSHOT"
ARG schema_version="1.138.3-SNAPSHOT"

LABEL Maintainer="cloudfeeds-core@rackspace.com" \
description="Docker image for Cloudfeeds Catalog" \
NAME="catalog"
LABEL com.rackspace.cloudfeeds.image.maintainer="cloudfeeds-core@rackspace.com" \
com.rackspace.cloudfeeds.image.description="Container image for Cloudfeeds Catalog" \
com.rackspace.cloudfeeds.image.name="catalog" \
com.rackspace.cloudfeeds.image.source="https://github.com/rackerlabs/cloudfeeds-catalog"

ENV SAXON_HOME=/etc/saxon \
SERVICE_PORT=${SERVICE_PORT:-$service_port}
SERVICE_PORT=${SERVICE_PORT:-$service_port} \
SCHEMA_VERSION=${SCHEMA_VERSION:-$schema_version} \
# OpenTelemetry
AWS_OTEL_JAVA_AGENT_VERSION="v1.29.0" \
CATALINA_OPTS="${CATALINA_OPTS} -javaagent:/tmp/aws-opentelemetry-agent.jar" \
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 \
OTEL_TRACES_EXPORTER=otlp \
OTEL_METRICS_EXPORTER=otlp

# add non privileged user
RUN groupadd --gid 1000 feeds && \
RUN groupadd --gid 1000 feeds && \
useradd -u 1000 -g feeds feeds && \
mkdir -p /etc/cloudfeeds/translation/ && \
chown -R feeds:feeds "${CATALINA_HOME}" /etc/cloudfeeds/translation/ && \
wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64 && \
chown feeds:feeds /usr/local/bin/dumb-init && \
chmod u+x /usr/local/bin/dumb-init
chmod u+x /usr/local/bin/dumb-init && \
wget -O /tmp/aws-opentelemetry-agent.jar https://github.com/aws-observability/aws-otel-java-instrumentation/releases/download/${AWS_OTEL_JAVA_AGENT_VERSION}/aws-opentelemetry-agent.jar

WORKDIR ${CATALINA_HOME}

#COPY --chown=feeds:docker ./docker/entrypoint_dev.sh .
COPY --chown=feeds:feeds --from=fetcher /home/cl/docker/feedscatalog.xml /etc/feedscatalog/
COPY --chown=feeds:feeds --from=fetcher /home/cl/docker/transform.xsl /usr/local/tomcat
COPY --chown=feeds:feeds --from=fetcher /home/cl/docker/feedscatalog.xml /etc/feedscatalog/
COPY --chown=feeds:feeds --from=fetcher /home/cl/docker/transform.xsl /usr/local/tomcat


RUN apt-get update && \


yes | apt-get install xsltproc && \

xsltproc --output /usr/local/tomcat/conf/server.xml /usr/local/tomcat/transform.xsl /usr/local/tomcat/conf/server.xml && \
rm -rf /var/lib/apt/lists/*

USER feeds:feeds
VOLUME /usr/local/tomcat/logs/


# ======================= get ca cert bundle from curl.haxx.se =======================
#RUN curl https://curl.haxx.se/ca/cacert.pem -L -o /cacert.pem

USER feeds
VOLUME /usr/local/tomcat/logs/ /var/log/catalog/

COPY --chown=feeds:feeds --from=package /usage-schema-${SCHEMA_VERSION}/xslt-artifacts/* /etc/cloudfeeds/translation/
Expand All @@ -100,7 +117,7 @@ EXPOSE ${SERVICE_PORT}

# Perform health check
HEALTHCHECK --interval=20s --timeout=5s --start-period=10s --retries=3 \
CMD curl -L --fail --silent --show-error --connect-timeout 3 --max-time 3 http://localhost:${SERVICE_PORT}/catalog || exit 1
CMD curl -L --fail --silent --show-error --connect-timeout 3 --max-time 3 http://localhost:${SERVICE_PORT}/feedscatalog/catalog/catalog-buildinfo || exit 1


#Start tomcat server
Expand Down
6 changes: 3 additions & 3 deletions docker/feedscatalog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
And the parameter values will be changed according to the env.
-->
<environment>
<vipURL>https://kavi3398.internal.test.aws.cloudfeeds.rackspace.net</vipURL>
<externalVipURL>https://kavi3398.internal.test.aws.cloudfeeds.rackspace.net</externalVipURL>
<prefsSvcVipURL>https://kavi3398.internal.test.aws.cloudfeeds.rackspace.net</prefsSvcVipURL>
<vipURL>https://arth3649.internal.test.aws.cloudfeeds.rackspace.net</vipURL>
<externalVipURL>https://arth3649.internal.test.aws.cloudfeeds.rackspace.net</externalVipURL>
<prefsSvcVipURL>https://arth3649.internal.test.aws.cloudfeeds.rackspace.net</prefsSvcVipURL>
</environment>
6 changes: 6 additions & 0 deletions docker/transform.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>

<xsl:template match="/Server/Service/Engine/Host/Valve/@pattern">
<xsl:attribute name="pattern">
<xsl:value-of select="'%h %l %u %t &quot;%r&quot; %s %b %{X-Amzn-Trace-Id}i'"/>
</xsl:attribute>
</xsl:template>

<xsl:template match="/Server/Service/Engine/Host/Valve">
<xsl:copy>
Expand Down