Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update ci build to use docker and ubi8 (#765)
- Loading branch information
Showing
5 changed files
with
177 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
.github/ | ||
.idea/ | ||
contrib/ci/ | ||
contrib/docker/ | ||
contrib/elasticsearch/ | ||
contrib/helm/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
ARG target_os=ubi8 | ||
|
||
|
||
|
||
FROM redhat/ubi8:8.9 AS base_ubi8 | ||
|
||
ENV JAVA_TOOL_OPTIONS -Dfile.encoding=UTF8 | ||
ENV PROJECT_BASE=/opt/emissary | ||
|
||
ARG java_version=11 | ||
ARG user=emissary | ||
ARG group=emissary | ||
ARG uid=1000 | ||
ARG gid=1000 | ||
RUN dnf update -y \ | ||
&& dnf upgrade -y \ | ||
&& rpm --import https://yum.corretto.aws/corretto.key \ | ||
&& curl -L -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo \ | ||
&& dnf install -y java-${java_version}-amazon-corretto-devel \ | ||
&& dnf install -y glibc-langpack-en lsof \ | ||
&& groupadd -g ${gid} ${group} \ | ||
&& useradd -u ${uid} -g ${group} -m -s /bin/sh ${user} \ | ||
&& dnf clean all -y \ | ||
&& rm -rf /var/cache/yum | ||
|
||
|
||
|
||
FROM centos:7 AS base_centos7 | ||
|
||
ENV JAVA_TOOL_OPTIONS -Dfile.encoding=UTF8 | ||
ENV PROJECT_BASE=/opt/emissary | ||
|
||
ARG java_version=11 | ||
ARG user=emissary | ||
ARG group=emissary | ||
ARG uid=1000 | ||
ARG gid=1000 | ||
RUN yum update -y \ | ||
&& yum upgrade -y \ | ||
&& rpm --import https://yum.corretto.aws/corretto.key \ | ||
&& curl -L -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo \ | ||
&& yum install -y java-${java_version}-amazon-corretto-devel \ | ||
&& yum install -y which lsof \ | ||
&& groupadd -g ${gid} ${group} \ | ||
&& useradd -u ${uid} -g ${group} -m -s /bin/bash ${user} \ | ||
&& yum clean all -y \ | ||
&& rm -rf /var/cache/yum | ||
|
||
|
||
|
||
FROM alpine:3 AS base_alpine3 | ||
|
||
ENV JAVA_TOOL_OPTIONS -Dfile.encoding=UTF8 | ||
ENV PROJECT_BASE=/opt/emissary | ||
|
||
ARG java_version=11 | ||
ARG user=emissary | ||
ARG group=emissary | ||
ARG uid=1000 | ||
ARG gid=1000 | ||
RUN apk update \ | ||
&& apk upgrade \ | ||
&& apk add ca-certificates \ | ||
&& update-ca-certificates \ | ||
&& apk add --update coreutils && rm -rf /var/cache/apk/* \ | ||
&& apk add --update openjdk${java_version} tzdata curl unzip bash which lsof \ | ||
&& apk add --no-cache nss \ | ||
&& addgroup --gid ${gid} ${group} \ | ||
&& adduser --disabled-password --uid ${uid} --ingroup ${group} ${user} \ | ||
&& rm -rf /var/cache/apk/* | ||
|
||
|
||
|
||
FROM base_${target_os} AS build | ||
|
||
ENV MAVEN_OPTS -Xms512M -Xmx1024M -Xss1M -Djava.awt.headless=true | ||
ENV MAVEN_HOME /opt/maven | ||
|
||
ARG maven_version=3.9.6 | ||
RUN curl -L -o /tmp/maven.tar.gz https://dlcdn.apache.org/maven/maven-3/${maven_version}/binaries/apache-maven-${maven_version}-bin.tar.gz \ | ||
&& tar xvf /tmp/maven.tar.gz -C /opt \ | ||
&& ln -s /opt/apache-maven-${maven_version} ${MAVEN_HOME} \ | ||
&& ln -s ${MAVEN_HOME}/bin/mvn /usr/bin/mvn | ||
|
||
COPY . ${PROJECT_BASE} | ||
RUN chown -R ${user}:${group} ${PROJECT_BASE} \ | ||
&& chmod -R 744 ${PROJECT_BASE} \ | ||
&& (rm -f .mvn-classpath || true) | ||
|
||
USER ${user} | ||
WORKDIR ${PROJECT_BASE} | ||
|
||
ARG java_compiler=11 | ||
RUN --mount=type=cache,uid=${uid},gid=${gid},target=/home/${user}/.m2 \ | ||
mvn -V -B -e -ntp "-Dstyle.color=always" -Dmaven.compiler.release=${java_compiler} clean verify -Pdist | ||
|
||
ARG verify_build=false | ||
RUN if ${verify_build} ; then ./contrib/ci/detect-changes.sh ; fi | ||
|
||
|
||
|
||
FROM base_${target_os} | ||
|
||
COPY --from=build ${PROJECT_BASE}/target/emissary-*-dist.tar.gz /tmp | ||
|
||
RUN tar -xf /tmp/emissary-*-dist.tar.gz -C /opt/ \ | ||
&& version=`ls /opt | grep emissary- | awk '{ print $1 }'` \ | ||
&& echo "Linking /opt/${version} to ${PROJECT_BASE}" \ | ||
&& ln -s /opt/${version} ${PROJECT_BASE} \ | ||
&& mkdir -p ${PROJECT_BASE}/localoutput \ | ||
&& mkdir -p ${PROJECT_BASE}/target/data \ | ||
&& chmod -R a+rw ${PROJECT_BASE} \ | ||
&& chown -R ${user}:${group} ${PROJECT_BASE}* \ | ||
&& rm -f /tmp/* | ||
|
||
USER ${user} | ||
|
||
WORKDIR ${PROJECT_BASE} | ||
|
||
VOLUME ${PROJECT_BASE}/target/data | ||
VOLUME ${PROJECT_BASE}/localoutput | ||
|
||
EXPOSE 8001 | ||
|
||
ENTRYPOINT ["./emissary"] | ||
|
||
CMD ["server", "-a", "2", "-p", "8001"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters