-
-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #179 from Sayrix/docker
Docker
- Loading branch information
Showing
6 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ LICENSE | |
package.json | ||
package-lock.json | ||
dist/ | ||
db-data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ config.jsonc | |
token.json | ||
dist | ||
.env | ||
*.db | ||
*.db | ||
db-data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
version: '3' | ||
|
||
services: | ||
bot: | ||
build: . | ||
container_name: ticket-bot | ||
environment: | ||
- TOKEN | ||
- DATABASE_URL=postgres://postgres:postgres@pgsql:5432/postgres | ||
depends_on: | ||
- pgsql | ||
restart: on-failure | ||
pgsql: | ||
image: postgres:15.3-alpine | ||
environment: | ||
- POSTGRES_PASSWORD=postgres | ||
volumes: | ||
- ./db-data:/var/lib/postgresql/data | ||
ports: | ||
- "5432:5432" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
npx prisma db push --schema=./prisma/docker.prisma | ||
npm run start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM node:20.3-alpine | ||
|
||
# Setup workspace | ||
WORKDIR /app | ||
ENV DATABASE_URL="postgresql://postgres:postgres@db:5432/postgres?schema=public" | ||
|
||
# Copy runtime files | ||
COPY ./config/config.jsonc ./config/config.jsonc | ||
COPY docker_run.sh . | ||
COPY locales ./locales | ||
|
||
# Prisma builds | ||
COPY prisma ./prisma | ||
RUN npx prisma generate --schema=./prisma/docker.prisma | ||
|
||
# Install dependencies | ||
COPY package.json . | ||
RUN npm install | ||
|
||
# Transpile the source | ||
COPY tsconfig.json . | ||
COPY src ./src | ||
RUN npm run build | ||
|
||
# Start the server | ||
CMD ["./docker_run.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Docker uses postgresql as the main database | ||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
|
||
datasource db { | ||
provider = "postgresql" | ||
url = env("DATABASE_URL") | ||
} | ||
|
||
model config { | ||
key String @id | ||
value String? @db.Text | ||
} | ||
|
||
model tickets { | ||
id Int @id @default(autoincrement()) | ||
channelid String @unique | ||
messageid String @unique | ||
category String @db.Text | ||
invited String @default("[]") | ||
reason String | ||
creator String | ||
createdat BigInt | ||
claimedby String? | ||
claimedat BigInt? | ||
closedby String? | ||
closedat BigInt? | ||
closereason String? | ||
transcript String? | ||
} |