Skip to content

Commit ec0abbf

Browse files
committed
Modify and fix automation scripts
1 parent f854b7a commit ec0abbf

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

backend/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,16 @@ RUN chmod +x migratePrisma.sh
2727
# RUN pnpm run build
2828
EXPOSE $NODE_DOCKER_PORT
2929

30-
CMD ["./waitForIt.sh", "db:3306", "--", "./migratePrisma.sh"]
30+
CMD ["./waitForIt.sh", "--host=db", "--port=3306"]
3131

32-
RUN echo "Running nginx server === $(pwd)"
32+
RUN echo "Running prisma migration === $(pwd)"
33+
34+
#CMD ["./migratePrisma.sh"]
3335

3436
CMD ["npx","prisma", "migrate", "dev"]
37+
38+
RUN echo "Running backend server === $(pwd)"
39+
3540
CMD ["pnpm", "run", "start"]
3641

3742
#CMD ["node","dist/main.js"]

backend/migratePrisma.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
#!/usr/bin/env bash
22
npx prisma generate
3+
npx prisma migrate dev
4+
35

backend/waitForIt.sh

100644100755
File mode changed.

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ services:
3838
image: vite_app
3939
restart: always
4040
env_file: .env
41+
depends_on:
42+
- backend
4143
build:
4244
context: ./frontend
4345
dockerfile: Dockerfile

start.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ pwd
1717
docker-compose up --build -d
1818

1919
# Navigate back to backend directory and run Prisma migrations
20-
echo "===========[ Run prisma migrate in backend...] ============"
2120
cd backend
22-
pwd
21+
echo "===========[ Have some tea first...] ============ ${pwd}"
22+
./waitForIt.sh --host=db --port=3306 --strict --timeout=30
23+
echo "===========[ Run prisma migrate in backend...] ============ ${pwd}"
2324
# npx prisma db seed
2425
npx prisma migrate dev
2526

0 commit comments

Comments
 (0)