-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
50 lines (31 loc) · 970 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
# Building layer
FROM node:16-alpine as development
WORKDIR /app
RUN echo "Going to deploy DEVELOPMENT"
# Copy configuration files
COPY tsconfig*.json ./
COPY package*.json ./
RUN echo "Should install nest globally DEVELOPMENT"
RUN npm install -g @nestjs/cli
# Install dependencies from package-lock.json, see https://docs.npmjs.com/cli/v7/commands/npm-ci
RUN npm ci
# Copy application sources (.ts, .tsx, js)
COPY . .
# Build application (produces dist/ folder)
RUN npm run build
# Runtime (production) layer
FROM node:16-alpine as production
WORKDIR /app
RUN echo "Going to deploy PROD"
# Copy dependencies files
COPY package*.json ./
RUN echo "Should install nest globally PROD"
RUN npm install -g @nestjs/cli
# Install runtime dependecies (without dev/test dependecies)
RUN npm ci --omit=dev
# Copy production build
COPY --from=development /app/dist/ ./dist/
# Expose application port
EXPOSE 8080
# Start application
CMD [ "node", "dist/main.js" ]