-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.alpine
More file actions
31 lines (21 loc) · 801 Bytes
/
Dockerfile.alpine
File metadata and controls
31 lines (21 loc) · 801 Bytes
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
# Usage: docker build -t mgxparser-alpine -f Dockerfile.alpine .
# curl -X POST -F "file=@/root/projects/MgxParser/MgxParser/test/test_records/aitest.mgx2" -F "command={\"map\":\"HD\"}" http://localhost:4400
# Phase 1: Compile the native module
FROM node:20.11.1-alpine3.19 as builder
WORKDIR /app
COPY . .
RUN apk add --no-cache \
alpine-sdk \
cmake \
libpng-dev openssl-dev
RUN npm install
RUN npx cmake-js rebuild --CDBUILD_STATIC=OFF -p $(nproc)
# Phase 2: Deploy the native module and the app
FROM node:20.11.1-alpine3.19
WORKDIR /parser
COPY --from=builder /app/build/Release/mgxnode.node .
COPY --from=builder /app/docker_exe/app.js .
COPY --from=builder /app/docker_exe/package.json .
RUN apk update && apk add libpng openssl
RUN npm install
CMD ["node", "app.js"]