Skip to content

Commit

Permalink
Merge pull request #712 from hwangsihu/main
Browse files Browse the repository at this point in the history
Revert "Merge branch 'production' into main"
  • Loading branch information
LucasB25 authored Aug 31, 2024
2 parents 3be6c52 + 74de4e5 commit 07f4d26
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 123 deletions.
69 changes: 34 additions & 35 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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 && \
Expand Down
5 changes: 2 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -87,4 +86,4 @@ services:
condition: service_healthy
networks:
lavalink:
name: lavalink
name: lavalink
117 changes: 36 additions & 81 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}

0 comments on commit 07f4d26

Please sign in to comment.