diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 145fc16c8..ab8a208f0 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -2,38 +2,37 @@ name: Build and publish a Docker image to ghcr.io on: push jobs: - docker_publish: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v3 - - name: Available platforms - run: echo ${{ steps.buildx.outputs.platforms }} - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: ghcr.io/appujet/lavamusic - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: . - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - platforms: | - linux/amd64 - linux/arm64 - build-args: | - DATABASE_URL=${{ secrets.DATABASE_URL }} + docker_publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + - name: Available platforms + run: echo ${{ steps.buildx.outputs.platforms }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/appujet/lavamusic + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: | + linux/amd64 + linux/arm64 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 28c9447cd..67a223ae8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,15 +20,13 @@ COPY tsconfig.json ./ # Copy prisma COPY prisma ./prisma # Generate Prisma client -RUN npx prisma generate +RUN npx prisma db push # Build TypeScript RUN npm run build # Stage 2: Create production image FROM node:22-slim -ARG DATABASE_URL -ENV DATABASE_URL=${DATABASE_URL} ENV NODE_ENV=production WORKDIR /opt/lavamusic/ @@ -47,7 +45,7 @@ COPY --from=builder /opt/lavamusic/locales ./locales RUN npm install --omit=dev RUN npx prisma generate -RUN npx prisma migrate deploy +RUN npx prisma db push # Ensure application.yml is a file, not a directory RUN rm -rf /opt/lavamusic/application.yml && \ diff --git a/docker-compose.yml b/docker-compose.yml index f39cc39a1..8d42fdbd1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -61,7 +61,7 @@ services: # services for lavamusic lavamusic: container_name: lavamusic - image: ghcr.io/appujet/lavamusic:production + image: ghcr.io/appujet/lavamusic:main environment: # Your lavalink url - LAVALINK_URL=lavalink:2333 @@ -72,7 +72,6 @@ services: # Your lavalink secure (true or false) - LAVALINK_SECURE=false # database url - - DATABASE_URL=DATABASE_URL # - DATABASE_URL= put your database url here (mongodb or postgres) # - DATABASE_URL=postgresql://lavamusic:lavamusic@postgres:5432/lavamusic (for postgres) # - DATABASE_URL=mongodb://mongoadmin:mongopassword@mongodb:27017/lavamusic?authSource=admin (for mongodb) @@ -87,4 +86,4 @@ services: condition: service_healthy networks: lavalink: - name: lavalink + name: lavalink \ No newline at end of file diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 6502bfa67..6ea936c86 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -5,112 +5,67 @@ // Try Prisma Accelerate: https://pris.ly/cli/accelerate-init generator client { - provider = "prisma-client-js" - binaryTargets = ["native", "debian-openssl-3.0.x"] + provider = "prisma-client-js" + binaryTargets = ["native", "debian-openssl-3.0.x"] } datasource db { - provider = "postgresql" - url = env("DATABASE_URL") + provider = "sqlite" + url = "file:./lavamusic.db" } model Guild { - guildId String @id - prefix String - language String? - stay Stay? - dj Dj? - roles Role[] - botchannel Botchannel? - setup Setup? + guildId String @id + prefix String + language String? + stay Stay? + dj Dj? + roles Role[] + setup Setup? } model Stay { - guildId String @id - textId String - voiceId String - Guild Guild @relation(fields: [guildId], references: [guildId]) + guildId String @id + textId String + voiceId String + Guild Guild @relation(fields: [guildId], references: [guildId]) } model Dj { - guildId String @id - mode Boolean - Guild Guild @relation(fields: [guildId], references: [guildId]) + guildId String @id + mode Boolean + Guild Guild @relation(fields: [guildId], references: [guildId]) } model Role { - guildId String - roleId String - Guild Guild @relation(fields: [guildId], references: [guildId]) + guildId String + roleId String + Guild Guild @relation(fields: [guildId], references: [guildId]) - @@unique([guildId, roleId]) + @@unique([guildId, roleId]) } model Playlist { - id String @id @default(uuid()) - userId String - name String - songs Song[] + id String @id @default(uuid()) + userId String + name String + songs Song[] - @@unique([userId, name]) + @@unique([userId, name]) } model Song { - id String @id @default(uuid()) - track String - playlistId String - playlist Playlist @relation(fields: [playlistId], references: [id]) + id String @id @default(uuid()) + track String + playlistId String + playlist Playlist @relation(fields: [playlistId], references: [id]) - @@unique([track, playlistId]) -} - -model Botchannel { - guildId String @id - textId String - Guild Guild @relation(fields: [guildId], references: [guildId]) + @@unique([track, playlistId]) } model Setup { - guildId String @id - textId String - messageId String - Guild Guild @relation(fields: [guildId], references: [guildId]) -} - -model Premium { - userId String @id - guildId String -} - -enum Languages { - EnglishUS - EnglishGB - German - Bulgarian - ChineseCN - ChineseTW - Croatian - Czech - Danish - Dutch - Finnish - French - Greek - Hindi - Hungarian - Italian - Japanese - Korean - Lithuanian - Norwegian - Polish - PortugueseBR - Romanian - Russian - SpanishES - Swedish - Thai - Turkish - Ukrainian - Vietnamese + guildId String @id + textId String + messageId String + Guild Guild @relation(fields: [guildId], references: [guildId]) }