From 97eda8c763732214a258613d6728c45d79d239bc Mon Sep 17 00:00:00 2001 From: Brandon Clayton <bclayton@usgs.gov> Date: Tue, 21 Dec 2021 13:02:39 -0700 Subject: [PATCH] simplify --- Dockerfile | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8a2638a..b415a4b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,68 +5,45 @@ # -t nshmp-ws-static . #### -ARG BUILD_IMAGE=usgs/java:11 -ARG FROM_IMAGE=usgs/java:11 +ARG BUILD_IMAGE=usgs/amazoncorretto:11 +ARG FROM_IMAGE=usgs/amazoncorretto:11 -ARG project=nshmp-ws-static -ARG workdir=/app/${project} -ARG libs_dir=${workdir}/build/libs -ARG jar_file=${libs_dir}/${project}.jar - -#### -# Build war file -#### FROM ${BUILD_IMAGE} as builder ARG gitlab_token=null ARG ci_job_token=null -ARG libs_dir -ARG jar_file -ARG workdir # TODO: Token needed until nshmp-lib is public ENV GITLAB_TOKEN ${gitlab_token} ENV CI_JOB_TOKEN ${ci_job_token} -WORKDIR ${workdir} +WORKDIR /app COPY . . -RUN ./gradlew assemble \ - && mv ${libs_dir}/*-all.jar ${jar_file} +RUN ./gradlew assemble #### # Run service #### FROM ${FROM_IMAGE} -# The NetCDF file to read in -ARG netcdf_file="src/main/resources/default.nc" - # The NSHM to use # Available NSHM to run: # - CONUS_2018A ENV NSHM "CONUS_2018A" - +ENV NETCDF_FILE src/main/resources/default.nc ENV CONTEXT_PATH "/" ENV JAVA_OPTS="" -ARG jar_file -ARG project -ARG workdir - -ENV PROJECT ${project} -ENV NETCDF_FILE ${netcdf_file} - -WORKDIR ${workdir} +WORKDIR /app -COPY --from=builder ${jar_file} ${project}.jar -COPY ${NETCDF_FILE} ${NETCDF_FILE} +COPY --from=builder /app/build/libs/nshmp-ws-static-all.jar nshmp-ws-static.jar ENTRYPOINT /usr/bin/java \ ${JAVA_OPTS} \ -jar \ - ${PROJECT}.jar \ + nshmp-ws-staic.jar \ "-Dmicronaut.server.context-path=${CONTEXT_PATH}" \ -nshm=${NSHM} \ -netcdf=${NETCDF_FILE} -- GitLab