forked from algoan/nestjs-tink-connector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
45 lines (33 loc) · 930 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
# ---------------
# Pull node image as Builder. we will transpile Ts files to Js here
# ---------------
FROM node:fermium-alpine as builder
# Create app directory
WORKDIR /usr/src/app
# copy sources files
COPY package*.json ./
COPY src ./src
COPY tsconfig*.json ./
COPY config ./config
# Install dependencies
RUN npm ci
# Transpile Typescript code to ES6 code into dist folder
RUN npm run build
# ---------------
# Multistage docker. This will be the final image
# ---------------
FROM node:fermium-alpine
WORKDIR /usr/src/app
# Install only production dependencies and clean tool builders
COPY package* ./
ENV NODE_ENV 'production'
# Copy secrets and config
COPY --from=builder /usr/src/app/config config
# Copy previously generated code
COPY --from=builder /usr/src/app/dist dist
RUN npm ci
USER node
# Set NODE_ENV to production and open
ENV DEPLOYMENT 'production.secret'
EXPOSE 8080
CMD [ "node", "dist/main.js"]