# Defining environment ARG APP_ENV=prod FROM adoptopenjdk/openjdk8:alpine-jre as base RUN addgroup -S datahub && adduser -S datahub -G datahub RUN apk --no-cache add curl FROM adoptopenjdk/openjdk8:alpine-slim as prod-build RUN apk --no-cache add perl ARG ENABLE_EMBER="false" ENV CI=true ENV GRADLE_OPTS="-Xms256m -Xmx512m" COPY . datahub-src RUN cd datahub-src && ./gradlew :datahub-frontend:dist -PenableEmber=${ENABLE_EMBER} -x test -x yarnTest -x yarnLint \ && cp datahub-frontend/build/distributions/datahub-frontend.zip ../datahub-frontend.zip \ && cd .. && rm -rf datahub-src && unzip datahub-frontend.zip FROM base as prod-install COPY --from=prod-build /datahub-frontend /datahub-frontend/ RUN chown -R datahub:datahub /datahub-frontend && chmod 755 /datahub-frontend FROM base as dev-install # Dummy stage for development. Assumes code is built on your machine and mounted to this image. # See this excellent thread https://github.com/docker/cli/issues/1134 VOLUME [ "/datahub-frontend" ] FROM ${APP_ENV}-install as final USER datahub ARG SERVER_PORT=9002 ENV SERVER_PORT=$SERVER_PORT RUN echo $SERVER_PORT EXPOSE $SERVER_PORT HEALTHCHECK --start-period=2m --retries=4 CMD curl --fail http://localhost:$SERVER_PORT/admin || exit 1 ENV JAVA_OPTS=" \ -Xms512m \ -Xmx1024m \ -Dhttp.port=$SERVER_PORT \ -Dconfig.file=datahub-frontend/conf/application.conf \ -Djava.security.auth.login.config=datahub-frontend/conf/jaas.conf \ -Dlogback.configurationFile=datahub-frontend/conf/logback.xml \ -Dlogback.debug=false \ -Dpidfile.path=/dev/null" CMD ["datahub-frontend/bin/playBinary"]