generated from RishabD/Express-TS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (33 loc) · 978 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
###############################################
# Node Base Image
###############################################
FROM node:18.13.0-alpine as node-base
###############################################
# Builder Image
###############################################
FROM node-base AS builder-base
RUN apk update
RUN apk add python3
RUN apk add gcc
RUN apk add make
RUN apk add g++
WORKDIR /app
COPY .nvmrc* ./
COPY package.json pnpm-lock.yaml* ./
RUN npm install -g pnpm
RUN pnpm i --frozen-lockfile;
###############################################
# Production Image
###############################################
FROM node:18.13.0-alpine as production
ARG DATABASE_URL
RUN npm install -g pnpm
WORKDIR /opt/app
RUN chmod -R 0777 /opt/app
COPY --from=builder-base /app/node_modules ./node_modules
COPY . .
ENV ENV=${ENV:-qa}
RUN DATABASE_URL=${DATABASE_URL} pnpm run build:prod
RUN addgroup --system --gid 1001 nodejs
USER 10000:10001
ENTRYPOINT ["sh", "./entrypoint.sh"]