-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
48 lines (33 loc) · 1.17 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
FROM hazmi35/node:18-dev-alpine as build-stage
LABEL name "sosmart-api (build-stage)"
LABEL maintainer "Technopark Neskar <technoparkn@gmail.com>"
WORKDIR /tmp/build
# Install build tools for node-gyp
RUN apk add --no-cache build-base git python3 openssl-compat1.1
# Copy package.json and package-lock.json
COPY package.json .
COPY package-lock.json .
# Install node dependencies
RUN npm install
# Now copy project files
COPY . .
# Build typescript project
RUN npm run build
# Prune dev dependencies
RUN npm prune --production
# Get ready for production
FROM hazmi35/node:18-alpine
LABEL name "sosmart-api"
LABEL maintainer "Technopark Neskar <technoparkn@gmail.com>"
WORKDIR /app
# Install dependencies
RUN apk add --no-cache tzdata
# Copy needed project files
COPY --from=build-stage /tmp/build/package.json .
COPY --from=build-stage /tmp/build/package-lock.json .
COPY --from=build-stage /tmp/build/node_modules ./node_modules
COPY --from=build-stage /tmp/build/dist ./dist
COPY --from=build-stage /tmp/build/secret-key .
COPY --from=build-stage /tmp/build/sosmart-technopark-firebase.json .
ENV TZ=Asia/Jakarta
CMD ["node", "--experimental-specifier-resolution=node", "dist"]