-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
53 lines (40 loc) · 1.02 KB
/
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
51
52
53
# ----------------
# Build stage
# ----------------
FROM node:16-alpine as build-stage
WORKDIR /app
# Installs pnpm
RUN npm i -g pnpm
# Installs sqlite3 prerequisite
RUN apk add --no-cache --virtual .build-deps make gcc g++ python3
# Copies pnpm deps
COPY package.json ./
COPY pnpm-lock.yaml ./
# Installs modules
RUN pnpm install
# Deletes prerequisite
RUN apk del .build-deps
# Copy the rest of the files
COPY . /app
# Builds into dist folder
RUN pnpm build
# ----------------
# Production stage
# ----------------
FROM node:16-alpine as production-stage
WORKDIR /app
# Installs pnpm
RUN npm i -g pnpm
# Copies pnpm deps
COPY package.json ./
COPY pnpm-lock.yaml ./
# Installs modules for the final time
RUN apk add --no-cache --virtual .build-deps make gcc g++ python3
RUN pnpm install --production
RUN apk del .build-deps
# Copies package.json files and built files
COPY --from=build-stage /app/package.json /app/package.json
COPY --from=build-stage /app/dist/ /app/dist/
# Starts the app
EXPOSE 42069
CMD ["npm", "start"]