blob: 1ea7ad35b250032726a776b99974b86dd50fba2e (
plain) (
blame)
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
|
# Stage 1. Base
FROM node:lts AS base
WORKDIR /app
# Stage 2. Dependencies
FROM base AS dependencies
COPY package*.json ./
COPY yarn.lock ./
COPY .yarnrc.yml ./
COPY .yarn ./.yarn
RUN yarn install
# Stage 3. TS compilation
FROM dependencies AS build
COPY src /app/src
COPY tsconfig.json /app
RUN yarn run tsc
# Stage 4. Release Image
FROM node:lts-alpine AS release
WORKDIR /app
COPY --from=dependencies /app/package.json ./
COPY --from=dependencies /app/yarn.lock ./
COPY --from=dependencies /app/.yarnrc.yml ./
COPY --from=dependencies /app/.yarn/releases ./.yarn/releases
COPY --from=dependencies /app/.yarn/cache ./.yarn/cache
COPY --from=dependencies /app/.yarn/plugins ./.yarn/plugins
RUN yarn install \
&& yarn workspaces focus -A --production \
&& yarn cache clean
COPY --from=build /app/build ./build
COPY public ./public
ENV NODE_ENV=production \
PORT=8080 \
BIND_ADDRESS=0.0.0.0 \
UPLOAD_LIMIT=134217700 \
LOG_LEVEL=info \
HOST_DIR=/data
RUN mkdir -p ${HOST_DIR}
VOLUME [ "${HOST_DIR}" ]
EXPOSE ${PORT}
CMD [ "node", "./build/index.js" ]
|