-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
44 lines (31 loc) · 901 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
FROM node:14.16.0-alpine3.13 as builder
# Install git (required by npm install)
RUN apk add --no-cache --virtual .build-deps git
# Install essential packages
RUN npm install -g npm@7
# Copy project
COPY . /app
WORKDIR /app
# Install vendors
RUN npm install
# Build the project
RUN npm run compile
# Copy static files
COPY ./src/public /app/dist/src/public
COPY ./src/init/tables.sql /app/dist/src/init/tables.sql
# Clean
RUN apk del .build-deps
FROM node:14.16.0-alpine3.13 as app
# Install git (required by npm install --production)
RUN apk add --no-cache --virtual .build-deps git
# Install essential packages
RUN npm install -g npm@7
# Copy project
COPY --from=builder /app/dist/src /app/src
COPY --from=builder /app/dist/package.json /app/package.json
COPY --from=builder /app/.env /app/.env
WORKDIR /app
# Install vendors
RUN npm install --production
# Clean
RUN apk del .build-deps