-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
32 lines (25 loc) · 878 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
# Step 1: Builder image
FROM docker.io/library/node:20-alpine3.17 AS builder
RUN npm install -g pkg pkg-fetch
ENV NODE node18
ENV PLATFORM alpine
RUN /usr/local/bin/pkg-fetch ${NODE} ${PLATFORM} ${TARGETARCH}
# Install app dependencies
WORKDIR /command
COPY ["package.json", "package-lock.json", "tsconfig.json", "./"]
RUN npm install
# Run tests
COPY spec /command/spec
COPY src /command/src
RUN npm test
# Build executable with Gulp
COPY ["tsconfig.json", "gulpfile.js", "./"]
COPY src /command/src
RUN npm run release
# Package app without dependencies
RUN /usr/local/bin/pkg --targets ${NODE}-${PLATFORM}-${TARGETARCH} dist/antora-indexer.js -o antora-indexer.bin
## Step 2: Runtime image
FROM docker.io/library/alpine:3.18
RUN apk add --no-cache libstdc++
COPY --from=builder /command/antora-indexer.bin /usr/local/bin/antora-indexer
ENTRYPOINT [ "antora-indexer" ]