generated from MapColonies/ts-server-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
45 lines (30 loc) · 1004 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
ARG CONFIG_UI_TAG_OR_HASH=a132252dda4dbe7ab0b14a92d0af06a9f50d7bd4
FROM node:20 as build
WORKDIR /tmp/buildApp
COPY ./package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:20 as build-ui
WORKDIR /tmp/buildApp
RUN apt-get update && apt-get install -y git
RUN git clone https://github.com/MapColonies/config-ui.git && \
cd config-ui && \
git checkout ${CONFIG_UI_TAG_OR_HASH} && \
npm ci && \
npm run build
FROM node:20.3.1-alpine3.17 as production
RUN apk add dumb-init
ENV NODE_ENV=production
ENV SERVER_PORT=8080
ENV SERVER_ENABLE_STATIC=true
ENV SERVER_API_PREFIX=/api
WORKDIR /usr/src/app
COPY --chown=node:node package*.json ./
RUN npm ci --only=production
COPY --chown=node:node --from=build /tmp/buildApp/dist .
COPY --chown=node:node ./config ./config
COPY --chown=node:node --from=build-ui /tmp/buildApp/config-ui/dist ./static
USER node
EXPOSE 8080
CMD ["dumb-init", "node", "--max_old_space_size=512", "--require", "./common/tracing.js", "./index.js"]