Skip to content

Commit 07bee6f

Browse files
committed
refactor: add entrypoint on docker
1 parent 2e345b2 commit 07bee6f

File tree

18 files changed

+71
-209
lines changed

18 files changed

+71
-209
lines changed

backend-auth/.docker/entrypoint.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
cd /backend/src/
4+
5+
if [ ! -f ".env" ]; then
6+
cp .env.example .env
7+
fi
8+
9+
npm install
10+
npm run migrate
11+
npm run start

backend-auth/.env backend-auth/.env.example

-2
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,3 @@ DB_NAME=database
1414
ALGORITHM=HS256
1515
LOGIN_EXPIRATION_TIME=7200
1616
SECRET_KEY=s//Vtnqog4NAxnOeQb1+CK4GyLpl2FDgd1TRTRJRZknqQDhdWK+zQVEQ6cqXuVvMVkwz9qmm/n/lAHgHRLosi8rjhQSRa09IQV1uX0lV9Zw2ZdG9i3odecZaD5TK/zTbFDpBYOEofwZKTt2MZhasKTGM0XWN6KDWhEP4o5cQQ2+U9VZtUE3LeK2Ez4TtMlAMfFB6gN3w1yCqm4C5+8pW2k+hiOK+1nSKTHWjLe4RljAz4NZtSpexfojSVHsMwnFEgCk2mzcBZQneZImc/Abq4bW77bDSVXYySUA32J8F6KRXMOeqJztA5/jU5F7w8GISyHLhlcRCzKyKWEaMalmEzA==
17-
18-

backend-auth/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
2-
docker
2+
docker
3+
.env

backend-auth/wait-for-it.sh

-182
This file was deleted.
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
cd /backend/src/
4+
5+
if [ ! -f ".env" ]; then
6+
cp .env.example .env
7+
fi
8+
9+
npm install
10+
npm run start
File renamed without changes.

backend-checkout/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
2-
docker
2+
docker
3+
.env

backend-order/.docker/entrypoint.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
cd /backend/src/
4+
5+
if [ ! -f ".env" ]; then
6+
cp .env.example .env
7+
fi
8+
9+
./wait-for-it.sh www.google.com:81 -- npm install && npm run migrate && npm run start
File renamed without changes.

backend-order/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
2-
docker
2+
docker
3+
.env

backend-payment/.docker/entrypoint.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
cd /backend/src/
4+
5+
if [ ! -f ".env" ]; then
6+
cp .env.example .env
7+
fi
8+
9+
./wait-for-it.sh www.google.com:81 -- npm install && npm run start
File renamed without changes.

backend-payment/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
2-
docker
2+
docker
3+
.env

backend-product/.docker/entrypoint.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
cd /backend/src/
4+
5+
if [ ! -f ".env" ]; then
6+
cp .env.example .env
7+
fi
8+
9+
npm install
10+
npm run migrate
11+
npm run start
File renamed without changes.

backend-product/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
2-
docker
2+
docker
3+
.env

docker-compose.yml

+5-15
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ services:
44
product-api:
55
container_name: "product-api-container"
66
image: node:10.16-slim
7+
entrypoint: ./.docker/entrypoint.sh
78
working_dir: /backend/src/
89
volumes:
910
- ./backend-product:/backend/src/
1011
depends_on:
1112
- product-postgres
12-
command: >
13-
bash -c "npm install
14-
&& npm run start"
1513
ports:
1614
- "3000:3000"
1715
environment:
@@ -21,12 +19,10 @@ services:
2119
checkout-api:
2220
container_name: "checkout-api-container"
2321
image: node:10.16-slim
22+
entrypoint: ./.docker/entrypoint.sh
2423
working_dir: /backend/src/
2524
volumes:
2625
- ./backend-checkout:/backend/src/
27-
command: >
28-
bash -c "npm install
29-
&& npm run start"
3026
depends_on:
3127
- rabbitmq-queue
3228
ports:
@@ -41,13 +37,11 @@ services:
4137
container_name: "auth-api-container"
4238
image: node:10.16-slim
4339
working_dir: /backend/src/
40+
entrypoint: ./.docker/entrypoint.sh
4441
volumes:
4542
- ./backend-auth:/backend/src/
4643
depends_on:
4744
- auth-postgres
48-
command: >
49-
bash -c "npm install
50-
&& npm run start"
5145
ports:
5246
- "3020:3000"
5347
environment:
@@ -57,15 +51,13 @@ services:
5751
order-api:
5852
container_name: "order-api-container"
5953
image: node:10.16-slim
54+
entrypoint: ./.docker/entrypoint.sh
6055
working_dir: /backend/src/
6156
volumes:
6257
- ./backend-order:/backend/src/
6358
depends_on:
6459
- order-postgres
6560
- rabbitmq-queue
66-
command: >
67-
bash -c "./wait-for-it.sh www.google.com:81 -- npm install
68-
&& npm run start"
6961
ports:
7062
- "3030:3000"
7163
environment:
@@ -77,12 +69,10 @@ services:
7769
payment-api:
7870
container_name: "payment-api-container"
7971
image: node:10.16-slim
72+
entrypoint: ./.docker/entrypoint.sh
8073
working_dir: /backend/src/
8174
volumes:
8275
- ./backend-payment:/backend/src/
83-
command: >
84-
bash -c "./wait-for-it.sh www.google.com:81 -- npm install
85-
&& npm run start"
8676
depends_on:
8777
- rabbitmq-queue
8878
ports:

0 commit comments

Comments
 (0)