Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(dockerfile): add dockerfile and docker-compose for easier set up #373

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM openjdk:17-jdk-bullseye as builder
WORKDIR /app
COPY gradle /app/gradle
COPY src /app/src
COPY gradlew build.gradle settings.gradle /app
RUN ./gradlew build

FROM openjdk:17-alpine as dist
COPY --from=builder /app/build/libs/aiode-1.0-SNAPSHOT.jar /app.jar
COPY versions.xml /
CMD java -jar /app.jar
16 changes: 16 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@ description = "aiode"
sourceCompatibility = "17"
targetCompatibility = "17"

task fatJar(type: Jar) {
manifest.from jar.manifest
classifier = 'all'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from {
configurations.runtimeClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
} {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
with jar
}

jar {
manifest {
attributes(
Expand Down
32 changes: 32 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Use postgres/example user/password credentials
version: '3.1'

services:

postgres:
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: aiodedbpassword
POSTGRES_DB: aiode
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- aiode_postgres:/var/lib/postgresql/data

bot:
image: <image_name>:latest
restart: always
depends_on:
- postgres
environment:
POSTGRES_PASSWORD: aiodedbpassword
POSTGRES_USERNAME: postgres
ADMIN_USERS: ""
YOUTUBE_CREDENTIALS: ""
SPOTIFY_CLIENT_ID: ""
SPOTIFY_CLIENT_SECRET: ""
DISCORD_TOKEN: ""
POSTGRES_JDBC_URI: jdbc:postgresql://postgres:5432/aiode
ports:
- 8000:8000
- 8080:8080