From 9ef44405a92b223929ad271a83cbe84003a3a35d Mon Sep 17 00:00:00 2001 From: ptrvsrg Date: Sun, 31 Mar 2024 21:24:16 +0700 Subject: [PATCH] =?UTF-8?q?TEMPLATE-15:=20=D0=9F=D0=BE=D0=B4=D0=B3=D0=BE?= =?UTF-8?q?=D1=82=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=20=D0=BA=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B7=D0=B2=D0=B5=D1=80=D1=82=D1=8B=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D1=8E=20=D0=B2=20=D0=BF=D1=80=D0=BE=D0=B4=D0=B0=D0=BA=D1=88?= =?UTF-8?q?=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 315 ++++++++++++++++++++++++ Dockerfile | 48 ++++ sample.env.development => sample.env | 0 src/main/resources/application-prod.yml | 14 ++ 4 files changed, 377 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile rename sample.env.development => sample.env (100%) diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2b5a5e4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,315 @@ +### Intellij template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Java template +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +replay_pid* + +### Maven template +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +# https://github.com/takari/maven-wrapper#usage-without-binary-jar +.mvn/wrapper/maven-wrapper.jar + +# Eclipse m2e generated files +# Eclipse Core +.project +# JDT-specific (Eclipse Java Development Tools) +.classpath + +### dotenv template +.env +.env.development + +### Linux template +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### Intellij+all template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +.idea +# User-specific stuff + +# AWS User-specific + +# Generated files + +# Sensitive or high-churn files + +# Gradle + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake + +# Mongo Explorer plugin + +# File-based project format + +# IntelliJ + +# mpeltonen/sbt-idea plugin + +# JIRA plugin + +# Cursive Clojure plugin + +# SonarLint plugin + +# Crashlytics plugin (for Android Studio and IntelliJ) + +# Editor-based Rest Client + +# Android studio 3.1+ serialized cache file + +### Gradle template +.gradle +**/build/ +!src/**/build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Avoid ignore Gradle wrappper properties +!gradle-wrapper.properties + +# Cache of project +.gradletasknamecache + +# Eclipse Gradle plugin generated files +# Eclipse Core +# JDT-specific (Eclipse Java Development Tools) + +### Windows template +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### macOS template +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Intellij+iml template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff + +# AWS User-specific + +# Generated files + +# Sensitive or high-churn files + +# Gradle + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake + +# Mongo Explorer plugin + +# File-based project format + +# IntelliJ + +# mpeltonen/sbt-idea plugin + +# JIRA plugin + +# Cursive Clojure plugin + +# SonarLint plugin + +# Crashlytics plugin (for Android Studio and IntelliJ) + +# Editor-based Rest Client + +# Android studio 3.1+ serialized cache file + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dc50fad --- /dev/null +++ b/Dockerfile @@ -0,0 +1,48 @@ +FROM amazoncorretto:17-alpine as jar-deps + +WORKDIR /opt/deps +COPY target/*.jar app.jar + +RUN unzip app.jar -d tmp && \ + jdeps \ + --print-module-deps \ + --ignore-missing-deps \ + --recursive \ + --multi-release 17 \ + --class-path="./tmp/BOOT-INF/lib/*" \ + --module-path="./tmp/BOOT-INF/lib/*" \ + app.jar > modules.txt + + +FROM amazoncorretto:17-alpine AS correto-jre + +ARG DEPS_PATH=/opt/deps + +COPY --from=jar-deps $DEPS_PATH/modules.txt $DEPS_PATH/modules.txt + +RUN apk add --no-cache binutils +RUN jlink \ + --verbose \ + --add-modules "$(cat $DEPS_PATH/modules.txt),jdk.crypto.ec,jdk.crypto.cryptoki" \ + --strip-debug \ + --no-man-pages \ + --no-header-files \ + --compress=2 \ + --output /opt/jre + +FROM alpine:latest + +ARG JRE_PATH=/opt/jre +ENV JAVA_HOME=$JRE_PATH +ENV PATH="${JAVA_HOME}/bin:${PATH}" + +WORKDIR /opt/workspace +COPY --from=correto-jre $JRE_PATH $JAVA_HOME +COPY target/*.jar template-service.jar + +RUN addgroup -S admin && adduser -S admin -G admin +USER admin + +EXPOSE 8084 + +ENTRYPOINT ["java", "-jar", "-Dspring.profiles.active=prod", "template-service.jar"] \ No newline at end of file diff --git a/sample.env.development b/sample.env similarity index 100% rename from sample.env.development rename to sample.env diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index e69de29..13f2fee 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -0,0 +1,14 @@ +server: + port: 8084 +spring: + application: + name: template-service + datasource: + url: jdbc:postgresql://${ARCHIPIO_TEMPLATE_SERVICE_DB_URL}/${ARCHIPIO_TEMPLATE_SERVICE_DB_NAME} + username: ${ARCHIPIO_TEMPLATE_SERVICE_DB_USER} + password: ${ARCHIPIO_TEMPLATE_SERVICE_DB_PASSWORD} + liquibase: + change-log: classpath:db/changelog/db.changelog-master.xml + url: jdbc:postgresql://${ARCHIPIO_TEMPLATE_SERVICE_DB_URL}/${ARCHIPIO_TEMPLATE_SERVICE_DB_NAME} + user: ${ARCHIPIO_TEMPLATE_SERVICE_DB_USER} + password: ${ARCHIPIO_TEMPLATE_SERVICE_DB_PASSWORD} \ No newline at end of file