mirror of
https://github.com/devproje/px32-bot.git
synced 2024-11-26 10:43:05 +00:00
docker: support docker compose
This commit is contained in:
parent
49af19fcd3
commit
293705da72
7 changed files with 77 additions and 10 deletions
45
.dockerfile
Normal file
45
.dockerfile
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
.fleet/
|
||||||
|
.kotlin/
|
||||||
|
|
||||||
|
.env
|
||||||
|
!.env.example
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
out/
|
||||||
|
!**/src/main/**/out/
|
||||||
|
!**/src/test/**/out/
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
bin/
|
||||||
|
!**/src/main/**/bin/
|
||||||
|
!**/src/test/**/bin/
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
1
.env.example
Normal file
1
.env.example
Normal file
|
@ -0,0 +1 @@
|
||||||
|
BOT_TOKEN=<discord_bot_token>
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -7,6 +7,9 @@ build/
|
||||||
.fleet/
|
.fleet/
|
||||||
.kotlin/
|
.kotlin/
|
||||||
|
|
||||||
|
.env
|
||||||
|
!.env.example
|
||||||
|
|
||||||
### IntelliJ IDEA ###
|
### IntelliJ IDEA ###
|
||||||
.idea/
|
.idea/
|
||||||
*.iws
|
*.iws
|
||||||
|
|
15
Dockerfile
15
Dockerfile
|
@ -1,12 +1,17 @@
|
||||||
FROM ghcr.io/graalvm/jdk:21
|
FROM amazoncorretto:21-alpine3.20
|
||||||
|
|
||||||
ARG TOKEN
|
ARG BOT_TOKEN
|
||||||
ENV TOKEN=${TOKEN}
|
ENV BOT_TOKEN=${BOT_TOKEN}
|
||||||
|
|
||||||
WORKDIR /opt/bot/src
|
WORKDIR /opt/bot/build
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
RUN chmod a+x ./gradlew
|
||||||
RUN ./gradlew shadowJar
|
RUN ./gradlew shadowJar
|
||||||
RUN cp ./build/libs/px32-bot.jar ../
|
RUN cp ./build/libs/px32-bot.jar ../
|
||||||
|
|
||||||
ENTRYPOINT ["BOT_TOKEN=${TOKEN}", "java", "-Xmx4096M", "-jar", "/opt/px32-bot.jar"]
|
WORKDIR /opt/bot
|
||||||
|
RUN rm -rf ./build
|
||||||
|
RUN export BOT_TOKEN=${BOT_TOKEN}
|
||||||
|
|
||||||
|
ENTRYPOINT ["java", "-Xmx4096M", "-jar", "/opt/bot/px32-bot.jar"]
|
||||||
|
|
|
@ -35,8 +35,8 @@ dependencies {
|
||||||
implementation("org.apache.logging.log4j:log4j-slf4j2-impl:$log4j_version")
|
implementation("org.apache.logging.log4j:log4j-slf4j2-impl:$log4j_version")
|
||||||
implementation("org.jetbrains.exposed:exposed-core:$exposed_version")
|
implementation("org.jetbrains.exposed:exposed-core:$exposed_version")
|
||||||
implementation("org.jetbrains.exposed:exposed-jdbc:$exposed_version")
|
implementation("org.jetbrains.exposed:exposed-jdbc:$exposed_version")
|
||||||
testImplementation(platform("org.junit:junit-bom:5.10.0"))
|
// testImplementation(platform("org.junit:junit-bom:5.10.0"))
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
// testImplementation("org.junit.jupiter:junit-jupiter")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
|
|
17
compose.yml
17
compose.yml
|
@ -1,4 +1,17 @@
|
||||||
version: "3.9"
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
bot:
|
||||||
|
container_name: "P_x32-bot"
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: "./Dockerfile"
|
||||||
|
env_file:
|
||||||
|
- ".env"
|
||||||
|
environment:
|
||||||
|
- BOT_TOKEN=${BOT_TOKEN}
|
||||||
|
networks:
|
||||||
|
- "bot"
|
||||||
|
volumes:
|
||||||
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
|
|
||||||
|
networks:
|
||||||
bot: {}
|
bot: {}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class Px32 {
|
||||||
|
|
||||||
private void register() {
|
private void register() {
|
||||||
commands.forEach(command -> {
|
commands.forEach(command -> {
|
||||||
jda.upsertCommand(command.getData()).queue();
|
jda.updateCommands().addCommands(command.getData()).queue();
|
||||||
log.info("Registered command: {}", command.getData().getName());
|
log.info("Registered command: {}", command.getData().getName());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue