File tree Expand file tree Collapse file tree 3 files changed +51
-3
lines changed Expand file tree Collapse file tree 3 files changed +51
-3
lines changed Original file line number Diff line number Diff line change @@ -6,4 +6,8 @@ npm run db:prod:migrate
6
6
# Checks admin table and will not seed if data exists
7
7
npm run db:prod:seed
8
8
9
- npm run start
9
+ rm -rf drizzle src tsconfig.json
10
+
11
+ npm uninstall tsx drizzle-kit
12
+
13
+ npm run start
Original file line number Diff line number Diff line change @@ -2,15 +2,26 @@ FROM node:lts-alpine AS build
2
2
WORKDIR /data/question-express
3
3
COPY package*.json ./
4
4
RUN npm install
5
+ ARG env
5
6
COPY . .
6
7
RUN npm run build
7
8
8
9
FROM node:lts-alpine AS production
9
10
WORKDIR /data/question-express
10
11
COPY --from=build /data/question-express/package*.json ./
11
- RUN npm ci --omit=dev
12
12
COPY --from=build --chown=node:node /data/question-express/dist ./dist
13
13
14
+ RUN npm ci --omit=dev
15
+
16
+ # For migration
17
+ RUN npm install tsx drizzle-kit
18
+ COPY drizzle ./drizzle
19
+ COPY src/lib/db/ ./src/lib/db
20
+ COPY src/config.ts ./src
21
+ COPY tsconfig.json .
22
+ COPY entrypoint.sh .
23
+
24
+
14
25
ARG port
15
26
EXPOSE ${port}
16
- CMD [ "npm " , "run" , "start " ]
27
+ ENTRYPOINT [ "/bin/sh " , "entrypoint.sh " ]
Original file line number Diff line number Diff line change @@ -98,6 +98,39 @@ services:
98
98
retries : 5
99
99
start_period : 5s
100
100
101
+ question-service :
102
+ image : " question-express"
103
+ container_name : " question-express"
104
+ build :
105
+ context : ./backend/question
106
+ dockerfile : express.Dockerfile
107
+ target : production
108
+ args :
109
+ # For building with the correct env vars
110
+ - env=${QUESTION_EXPRESS_ENV}
111
+ - port=${QUESTION_EXPRESS_PORT}
112
+ ports :
113
+ - " 9002:${QUESTION_EXPRESS_PORT}"
114
+ env_file :
115
+ - ./backend/question/.env.compose
116
+ environment :
117
+ # Docker Compose Specific for Service Discovery
118
+ - EXPRESS_DB_HOST=question-db
119
+ - EXPRESS_DB_PORT=5432
120
+ depends_on :
121
+ question-db :
122
+ condition : service_healthy
123
+ restart : true
124
+ networks :
125
+ - question-db-network
126
+ - question-api-network
127
+ healthcheck :
128
+ test : wget --no-verbose --tries=1 --spider http://localhost:9002/health || exit 1
129
+ interval : 30s
130
+ timeout : 10s
131
+ retries : 5
132
+ start_period : 5s
133
+
101
134
volumes :
102
135
# Persistent Volumes for Databases
103
136
user-db-docker :
You can’t perform that action at this time.
0 commit comments