Skip to content

Commit

Permalink
fix docker compose build
Browse files Browse the repository at this point in the history
  • Loading branch information
cataclym committed Aug 28, 2024
1 parent 1e89615 commit 0c2eacc
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ DB_NAME=kaikidb
# Docker
NODE_DOCKER_PORT=8080
NODE_ENV=production
# Same as DATABASE_URL but with localhost instead of db as host.
DATABASE_URL_DOCKER_BUILD=

# Bot settings
DADBOT_MAX_LENGTH=256
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ RUN apt update && curl -sLO https://github.com/fastfetch-cli/fastfetch/releases/
COPY package*.json ./
RUN npm install
COPY prisma .
RUN npx prisma generate
ARG DATABASE_URL
ENV DATABASE_URL $DATABASE_URL
RUN npx prisma db pull && npx prisma generate
COPY . ./
RUN npm run build
CMD ["npm", "run", "dev"]
17 changes: 17 additions & 0 deletions db.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
services:
db:
image: mariadb:latest
restart: unless-stopped
env_file: ./.env
command: --wait-timeout=28800
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=$DB_ROOT_PASSWORD
- MYSQL_DATABASE=$DB_NAME
- MYSQL_USER=$DB_USER
- MYSQL_PASSWORD=$DB_PASSWORD
volumes:
- db:/var/lib/mysql
volumes:
db:
24 changes: 5 additions & 19 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,19 @@
version: "3.8"
include:
- db.yml

services:
db:
image: mariadb:latest
restart: unless-stopped
env_file: ./.env
command: --wait-timeout=28800
ports:
- "3307:3306"
environment:
- MYSQL_ROOT_PASSWORD=$DB_ROOT_PASSWORD
- MYSQL_DATABASE=$DB_NAME
- MYSQL_USER=$DB_USER
- MYSQL_PASSWORD=$DB_PASSWORD
volumes:
- db:/var/lib/mysql
kaikibot:
depends_on:
- db
build:
context: .
dockerfile: Dockerfile.dev
network: host
args:
- DATABASE_URL=$DATABASE_URL
- DATABASE_URL=$DATABASE_URL_DOCKER_BUILD
restart: unless-stopped
env_file: ./.env
stdin_open: true
tty: true
volumes:
- ./src:/usr/app/src
volumes:
db:
- ./src:/usr/app/src

0 comments on commit 0c2eacc

Please sign in to comment.