forked from Sanders/TelegaBot
feat: Add Docker setup with environment variable configuration
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
.git
|
||||
.gitignore
|
||||
target
|
||||
*.iml
|
||||
.idea
|
||||
*.md
|
||||
@@ -40,3 +40,5 @@ out/
|
||||
### Secret configurations ###
|
||||
###src/main/resources/application-secrets.properties
|
||||
*.secrets.*
|
||||
# Docker
|
||||
*.jar
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
# Сборка приложения
|
||||
FROM maven:3.8.6-openjdk-11 AS build
|
||||
WORKDIR /app
|
||||
COPY pom.xml .
|
||||
COPY src ./src
|
||||
RUN mvn clean package -DskipTests
|
||||
|
||||
# Запуск приложения
|
||||
FROM openjdk:11-jre-slim
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/target/*.jar app.jar
|
||||
|
||||
# Переменные окружения для конфигурации
|
||||
ENV SPRING_DATASOURCE_URL=${DB_URL}
|
||||
ENV SPRING_DATASOURCE_USERNAME=${DB_USER}
|
||||
ENV SPRING_DATASOURCE_PASSWORD=${DB_PASSWORD}
|
||||
ENV BOT_TOKEN=${BOT_TOKEN}
|
||||
ENV BOT_NAME=${BOT_NAME}
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["java","-jar","app.jar"]
|
||||
@@ -1,8 +1,8 @@
|
||||
# Telegram configuration
|
||||
bot.token=5908676914:AAGU9LVyXYZYafpRgwOf1tolk0HGYvcHszY
|
||||
bot.name=TelegaBot
|
||||
bot.token=${BOT_TOKEN:5908676914:AAGU9LVyXYZYafpRgwOf1tolk0HGYvcHszY}
|
||||
bot.name=${BOT_NAME:TelegaBot}
|
||||
|
||||
# Database configuration
|
||||
spring.datasource.url=jdbc:postgresql://192.168.0.10:5432/telegabot
|
||||
spring.datasource.username=postgres
|
||||
spring.datasource.password=Vftrixpo05
|
||||
spring.datasource.url=${DB_URL:jdbc:postgresql://192.168.0.10:5432/telegabot}
|
||||
spring.datasource.username=${DB_USER:postgres}
|
||||
spring.datasource.password=${DB_PASSWORD:Vftrixpo05}
|
||||
|
||||
Reference in New Issue
Block a user