Коммит 94a5e529 создал по автору Radch-enko's avatar Radch-enko
Просмотр файлов

Cleanup: remove unused application configuration files and streamline Docker setup

- Deleted `application-dev.yml`, `application-staging.yml`, and `application-live.yml` as they are no longer in use.
- Updated `Dockerfile` to create a multi-stage build, improving caching and reducing image size.
- Simplified `docker-compose.yml` by removing redundant `SPRING_PROFILES_ACTIVE` environment variable.
владелец 45d2b410
FROM eclipse-temurin:17-jdk-alpine as build
WORKDIR /workspace/app
# Stage 1: Build the application
FROM gradle:7.6.1-jdk17 AS build
# Copy gradle files
COPY gradle gradle
WORKDIR /app
# Copy the gradle files first to leverage Docker cache
COPY gradle/ gradle/
COPY gradlew .
COPY gradlew.bat .
COPY settings.gradle.kts .
COPY build.gradle.kts .
COPY gradle.properties .
COPY buildSrc buildSrc
COPY backend/app app
COPY backend/domain domain
COPY backend/repository repository
COPY build-logic/ build-logic/
# Copy the source code
COPY backend/ backend/
# Build the application
RUN ./gradlew clean build -x test
RUN ./gradlew :backend:app:bootJar --no-daemon
# Stage 2: Run the application
FROM eclipse-temurin:17-jre
# Install curl for health checks
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Extract the layers
FROM eclipse-temurin:17-jre-alpine
VOLUME /tmp
ARG JAR_FILE=/workspace/app/app/build/libs/app-boot.jar
COPY --from=build ${JAR_FILE} app.jar
# Copy the built jar file from the build stage
COPY --from=build /app/backend/app/build/libs/*.jar app.jar
# Set up environment variables
ENV SPRING_PROFILES_ACTIVE=live
ENV JAVA_OPTS="-Xms512m -Xmx1024m"
# Expose the port
EXPOSE 8080
# Run the application
ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} -jar /app.jar"]
ENTRYPOINT ["java", "-jar", "/app/app.jar"]
# Dev profile configuration
# This profile exists for deploying Development environments.
spring:
datasource:
url: ${SPRING_DATASOURCE_URL:jdbc:postgresql://db:5432/effectiveoffice}
username: ${SPRING_DATASOURCE_USERNAME:postgres}
password: ${SPRING_DATASOURCE_PASSWORD:postgres}
driver-class-name: org.postgresql.Driver
hikari:
connection-timeout: 30000
maximum-pool-size: 10
minimum-idle: 5
jpa:
hibernate:
ddl-auto: validate
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
format_sql: true
show_sql: true # Show SQL for development debugging
use_sql_comments: true
open-in-view: false
flyway:
enabled: true
baseline-on-migrate: true
locations: classpath:db/migration
table: flyway_schema_history
logging:
level:
org.hibernate.SQL: DEBUG
band.effective.office.backend: DEBUG
calendar:
provider: dummy
\ Нет новой строки в конце файла
# Live profile configuration
# This profile exists for deploying Live (production) environments.
spring:
datasource:
url: ${SPRING_DATASOURCE_URL:jdbc:postgresql://db:5432/effectiveoffice}
username: ${SPRING_DATASOURCE_USERNAME:postgres}
password: ${SPRING_DATASOURCE_PASSWORD:postgres}
driver-class-name: org.postgresql.Driver
hikari:
connection-timeout: 30000
maximum-pool-size: 20
minimum-idle: 10
pool-name: EffectiveOfficeHikariCP
idle-timeout: 600000
max-lifetime: 1800000
jpa:
hibernate:
ddl-auto: validate
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
format_sql: false
show_sql: false
use_sql_comments: false
open-in-view: false
flyway:
enabled: true
baseline-on-migrate: true
locations: classpath:db/migration
table: flyway_schema_history
logging:
level:
root: WARN
band.effective.office.backend: INFO
org.springframework: WARN
# Additional production settings
server:
tomcat:
max-threads: 200
min-spare-threads: 20
max-connections: 10000
connection-timeout: 20000
# Staging profile configuration
# This profile exists for deploying Staging environments.
spring:
datasource:
url: ${SPRING_DATASOURCE_URL:jdbc:postgresql://db:5432/effectiveoffice}
username: ${SPRING_DATASOURCE_USERNAME:postgres}
password: ${SPRING_DATASOURCE_PASSWORD:postgres}
driver-class-name: org.postgresql.Driver
hikari:
connection-timeout: 30000
maximum-pool-size: 15
minimum-idle: 8
pool-name: EffectiveOfficeHikariCP
jpa:
hibernate:
ddl-auto: validate
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
format_sql: false
show_sql: false
use_sql_comments: false
open-in-view: false
flyway:
enabled: true
baseline-on-migrate: true
locations: classpath:db/migration
table: flyway_schema_history
logging:
level:
root: INFO
band.effective.office.backend: INFO
org.springframework: INFO
......@@ -9,7 +9,6 @@ services:
ports:
- "8080:8080"
environment:
- SPRING_PROFILES_ACTIVE=${SPRING_PROFILES_ACTIVE:-live}
- SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/effectiveoffice
- SPRING_DATASOURCE_USERNAME=postgres
- SPRING_DATASOURCE_PASSWORD=postgres
......@@ -51,4 +50,4 @@ networks:
driver: bridge
volumes:
postgres-data:
\ Нет новой строки в конце файла
postgres-data:
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать