generated from fabalexsie/WebAppStarterTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
35 lines (27 loc) · 858 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
FROM node:18.14.2 AS frontend-builder
# FRONTEND
# install npm packages
WORKDIR /app/frontend
COPY frontend/package.json frontend/package-lock.json ./
RUN npm install
# production build of react
COPY frontend/public ./public
COPY frontend/src ./src
COPY frontend/tsconfig.json frontend/tailwind.config.js ./
RUN npm run build
FROM node:18.14.2 AS runner
## BACKEND
# install npm packages
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
RUN npm install ts-node
# copy production build from frontend-builder
COPY --from=frontend-builder /app/frontend/build ./frontend/build
# we have shared data types between frontend and backend
COPY --from=frontend-builder /app/frontend/src/utils/data.ts ./frontend/src/utils/data.ts
# copy server files
COPY src ./src
COPY scripts ./scripts
# run server
ENTRYPOINT ["npm", "run" ,"production"]