social-network/Dockerfile
Struchkov Mark eeb14cdca9
Add exception handling and database changes
New exception handlers have been added and database setup files introduced. This update also deletes unnecessary Docker and Java files, and modifies various files related to error handling and database changes. Exception handlers for runtime, social network, and not found exceptions are added to improve error feedback in the application. Database setup includes a Liquibase changelog and SQL scripts to create the person table in the database.
2024-03-09 20:54:23 +03:00

49 lines
2.2 KiB
Docker

FROM eclipse-temurin:21 as app-build
ENV RELEASE=21
WORKDIR /opt/build
COPY .mvn .
COPY pom.xml .
COPY network-backend/pom.xml ./network-backend/pom.xml
COPY network-context/pom.xml ./network-context/pom.xml
COPY network-controller-rest/pom.xml ./network-controller-rest/pom.xml
COPY network-core/pom.xml ./network-core/pom.xml
COPY network-data-jooq/pom.xml ./network-data-jooq/pom.xml
COPY network-data-panache/pom.xml ./network-data-panache/pom.xml
COPY network-domain/pom.xml ./network-domain/pom.xml
COPY network-exception/pom.xml ./network-exception/pom.xml
COPY network-schema-rest/pom.xml ./network-schema-rest/pom.xml
COPY . .
RUN ./mvnw -T 1C dependency:go-offline
RUN ./mvnw -T 1C -Dquarkus.package.type=uber-jar clean package && mv network-backend/target/ ./uber-jar && ./mvnw -T 1C clean package && mv network-backend/target/quarkus-app/* . && mv network-backend/target/*.jar .
RUN $JAVA_HOME/bin/jlink \
--add-modules `jdeps --ignore-missing-deps -q -recursive --multi-release ${RELEASE} --print-module-deps --class-path 'lib/boot/*:lib/main/*:quarkus/*:app/*:*.jar' uber-jar/*.jar`,jdk.zipfs,jdk.crypto.cryptoki \
--strip-java-debug-attributes \
--no-man-pages \
--no-header-files \
--compress=2 \
--output jdk
RUN rm -rf /opt/build/.mvn /opt/build/*.xml /opt/build/network-*/ /opt/build/uber-jar
FROM debian:buster-slim
ARG BUILD_PATH=/opt/build
ENV JAVA_HOME=/quarkus-app/jdk
ENV PATH "${JAVA_HOME}/bin:${PATH}"
RUN groupadd --gid 1000 quarkus-app && useradd --uid 1000 --gid quarkus-app --shell /bin/bash --create-home quarkus-app
USER quarkus-app:quarkus-app
WORKDIR /quarkus-app
COPY --from=app-build --chown=quarkus-app:quarkus-app $BUILD_PATH/jdk/ ./jdk/
COPY --from=app-build --chown=quarkus-app:quarkus-app $BUILD_PATH/lib/ ./lib/
COPY --from=app-build --chown=quarkus-app:quarkus-app $BUILD_PATH/*.jar ./
COPY --from=app-build --chown=quarkus-app:quarkus-app $BUILD_PATH/app/ ./app/
COPY --from=app-build --chown=quarkus-app:quarkus-app $BUILD_PATH/quarkus/ ./quarkus/
EXPOSE 8080 8090
ENTRYPOINT ["java", "-jar", "-Dfile.encoding=UTF8", "-Dconsole.encoding=UTF8", "-Dorg.jooq.no-tips=true", "-Dorg.jooq.no-logo=true", "/quarkus-app/quarkus-run.jar"]