Skip to content

Commit

Permalink
chore: fix docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
cooderl committed Feb 29, 2024
1 parent a22c6da commit d53eb6f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ ENV MAX_REQUEST_PER_MINUTE=60
ENV AUTH_CODE=""
ENV DATABASE_URL=""

CMD ["npm", "run", "start:migrate:prod"]
RUN chmod +x ./docker-bootstrap.sh

CMD ["./docker-bootstrap.sh"]
8 changes: 8 additions & 0 deletions apps/server/docker-bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

#!/bin/sh
# ENVIRONEMTN from docker-compose.yaml doesn't get through to subprocesses
# Need to explicit pass DATABASE_URL here, otherwise migration doesn't work
# Run migrations
DATABASE_URL=${DATABASE_URL} npx prisma migrate deploy
# start app
DATABASE_URL=${DATABASE_URL} node dist/main
1 change: 1 addition & 0 deletions apps/server/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ datasource db {

generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl"] // 生成linux可执行文件
}

// 读书账号
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ services:
# 请修改为自己的密码
MYSQL_ROOT_PASSWORD: 123456
TZ: 'Asia/Shanghai'
ports:
- 3306:3306
# ports:
# - 3306:3306

server:
image: cooderl/wewe-rss-server:latest
Expand Down

0 comments on commit d53eb6f

Please sign in to comment.