-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerfile
59 lines (44 loc) · 1021 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# --------------------------
# build react app
# --------------------------
FROM node:15-alpine as builder
# set working directory
WORKDIR /app
# add environment variables
ARG API_HOST
ARG API_PORT
ENV REACT_APP_API_HOST=$API_HOST \
REACT_APP_API_PORT=$API_PORT
# add dependencies
COPY ./app/package*.json ./
# install dependencies
RUN npm install [email protected] -g --silent && \
npm install --silent
# add app
COPY ./app/public ./public
COPY ./app/src ./src
# build app
RUN npm run build
# --------------------------
# build fastify and run image
# --------------------------
FROM node:15-alpine
# database information
ENV PGHOST \
PGPORT \
PGDATABASE \
PGUSER \
PGPASSWORD \
# port for the fastify server to listen on
PORT
# set working directory
WORKDIR /app
COPY --from=builder /app/build ./build
# add dependencies
COPY ./server/package*.json ./
# install dependencies
RUN npm install --silent
# add app
COPY ./server/app.js .
# start app
CMD ["node", "app.js"]