From 42bdb2bc419c21bafb5d5a804a183999ef866360 Mon Sep 17 00:00:00 2001 From: "A.J. Stein" Date: Mon, 23 Sep 2024 23:53:42 -0400 Subject: [PATCH] [WIP] Initial pass at Dockerfile for #22 --- Dockerfile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dce5fc7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +ARG BUILDER_IMAGE=maven:3.9.9-eclipse-temurin-17-alpine +ARG RUNNER_IMAGE=eclipse-temurin:17-alpine +ARG CONTAINER_BUILD=yes + +FROM ${BUILDER_IMAGE} as builder +ARG CONTAINER_BUILD +COPY . /usr/local/src +RUN if [ -n "$CONTAINER_BUILD" ]; \ + then apk add --no-cache git unzip && \ + cd /usr/local/src && \ + mvn -B -e -Prelease package; \ + else echo Building on host outside container to copy later; \ + fi && \ + cp target/*.zip /tmp +COPY ./target/oscal-cli-enhanced-2.1.0-SNAPSHOT-oscal-cli.zip /tmp +WORKDIR /tmp +RUN unzip *.zip -d /opt/oscal-cli-extended + + +FROM ${RUNNER_IMAGE} as runner +COPY --from=builder /opt/oscal-cli-extended /opt/oscal-cli-extended +WORKDIR /opt/oscal-cli-extended +ENTRYPOINT [ "/opt/oscal-cli-extended/bin/oscal-cli" ]