forked from stationmoney/station
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
59 lines (39 loc) · 1.31 KB
/
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
FROM node:16 as builder
WORKDIR /app
RUN set -eux &&\
apt update &&\
apt install -y \
libudev-dev \
libusb-1.0-0-dev
COPY package*.json ./
COPY tsconfig.json ./
RUN set -eux && \
npm install -g typescript react-scripts && \
npm install --include=dev
COPY . .
ARG REACT_APP_ASSETS="https://assets.terra.dev" \
REACT_APP_STATION_ASSETS="https://station-assets.terra.dev"
ENV REACT_APP_ASSETS=${REACT_APP_ASSETS} \
REACT_APP_STATION_ASSETS=${REACT_APP_STATION_ASSETS}
RUN set -eux && \
npm run build --openssl-legacy-provider
###############################################################################
FROM node:16 as reloader
ARG REACT_APP_ASSETS="https://assets.terra.dev" \
REACT_APP_STATION_ASSETS="https://station-assets.terra.dev"
ENV REACT_APP_ASSETS=${REACT_APP_ASSETS} \
REACT_APP_STATION_ASSETS=${REACT_APP_STATION_ASSETS}
# add node modules to parent directory
COPY --from=builder /app/node_modules /app/node_modules
ENV PATH=/app/node_modules/.bin:$PATH
# use bind mount to enable hot reloading
WORKDIR /app/src
COPY . .
CMD ["npm", "run", "start"]
###############################################################################
FROM node:16-alpine
WORKDIR /app
COPY --from=builder /app/build .
RUN set -eux && \
npm install -g serve
CMD ["serve", "-s", "."]