Skip to content

Commit

Permalink
feat: build native image version
Browse files Browse the repository at this point in the history
  • Loading branch information
QuadStingray committed Oct 13, 2023
1 parent c2a141a commit a6dd1e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
12 changes: 4 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@ RUN chmod +x /mongocamp-cli/prepare-build.sh;
RUN /mongocamp-cli/prepare-build.sh;
WORKDIR /mongocamp-cli/
RUN eval "$(cs java --jvm $GRAAL_VERSION --env)"; $JAVA_HOME/bin/gu install native-image; sbt clean publishLocal mongocamp-cli/graalvm-native-image:packageBin;
# todo: reactivate build if fixed. https://github.com/oracle/graal/issues/7264
#RUN /mongocamp-cli/mongocamp-cli/target/graalvm-native-image/mongocamp-cli prepare native
RUN /mongocamp-cli/mongocamp-cli/target/graalvm-native-image/mongocamp-cli prepare cache;
RUN /mongocamp-cli/mongocamp-cli/target/graalvm-native-image/mongocamp-cli prepare native
# RUN /mongocamp-cli/mongocamp-cli/target/graalvm-native-image/mongocamp-cli prepare cache;

FROM debian:12.1-slim
COPY --from=builder /mongocamp-cli/mongocamp-cli/target/graalvm-native-image/mongocamp-cli /opt/bin/mongocamp-cli
## todo: reactivate build if fixed. https://github.com/oracle/graal/issues/7264
## COPY --from=builder /mongocamp-cli/server-raw /opt/bin/server-raw
COPY --from=builder /mongocamp-cli/server-raw /opt/bin/server-raw
ENV MODE="default"
WORKDIR /opt/bin/
## todo: reactivate build if fixed. https://github.com/oracle/graal/issues/7264
# RUN mkdir -p /opt/mongocamp/plugins; chmod -R 777 /opt/mongocamp/plugins; chmod +x /opt/bin/mongocamp-cli; chmod +x /opt/bin/server-raw; apt-get update;
RUN mkdir -p /opt/mongocamp/plugins; chmod -R 777 /opt/mongocamp/plugins; chmod +x /opt/bin/mongocamp-cli;
RUN mkdir -p /opt/mongocamp/plugins; chmod -R 777 /opt/mongocamp/plugins; chmod +x /opt/bin/mongocamp-cli; chmod +x /opt/bin/server-raw; apt-get update;
ENTRYPOINT ./mongocamp-cli run $MODE
12 changes: 6 additions & 6 deletions build_docker.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ commands += Command.command("ci-docker")((state: State) => {
throw new Exception(s"Not zero exit code for build base image: ${containerName}")
}

// todo: reactivate build if fixed. https://github.com/oracle/graal/issues/7264
// val containerNameCached = s"mongocamp-server:${version.value}-cached"
// val buildCommandCached = s"docker buildx build --platform=${listOfPlatforms.mkString(",")} --build-arg MONGOCAMPVERSION=${version.value} --tag ${containerNameCached} -f DockerfileJVMCached --push ."
// if (buildCommandCached.!(ProcessLogger(stout => state.log.info(stout), sterr => state.log.info(sterr))) != 0) {
// throw new Exception(s"Not zero exit code for build cached image: ${containerNameCached}")
// }
val containerNameCached = s"mongocamp-server:${version.value}-cached"
val buildCommandCached = s"docker buildx build --platform=${listOfPlatforms.mkString(",")} --build-arg MONGOCAMPVERSION=${version.value} --tag ${containerNameCached} -f DockerfileJVMCached --push ."

if (buildCommandCached.!(ProcessLogger(stout => state.log.info(stout), sterr => state.log.info(sterr))) != 0) {
throw new Exception(s"Not zero exit code for build cached image: ${containerNameCached}")
}

state
}
Expand Down

0 comments on commit a6dd1e2

Please sign in to comment.