-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (44 loc) · 1.48 KB
/
Dockerfile
File metadata and controls
55 lines (44 loc) · 1.48 KB
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
54
55
ARG NODE_VERSION=22.20.0
ARG NODE_TEST_VERSION=22.20.0
FROM node:${NODE_VERSION}-alpine3.21 AS base
RUN apk add --no-cache \
docker \
openjdk11 \
make
FROM base AS install-base
WORKDIR /project
COPY . .
RUN --mount=type=cache,target=/root/.npm \
npm install
FROM install-base AS build
RUN npm run build
FROM build AS lint
RUN npm run lint
FROM build AS test-build
ENV DOCKER_HOST=tcp://host.docker.internal:2375
RUN npm test
FROM node:${NODE_TEST_VERSION}-alpine3.21 AS test-integration-build
WORKDIR /workspace
ENV DOCKER_HOST=tcp://host.docker.internal:2375
COPY --link --from=build /project node-sdk
COPY --link --from=build /project/test-integration/cjs-project cjs-project
COPY --link --from=build /project/test-integration/esm-project esm-project
RUN --mount=type=cache,target=/root/.npm \
cd cjs-project && \
npm install ../node-sdk && \
npm install && \
npm test
RUN --mount=type=cache,target=/root/.npm \
cd esm-project && \
npm install ../node-sdk && \
npm install && \
npm test
FROM scratch AS dist
COPY --link --from=build /project/dist /
FROM scratch AS types
COPY --link --from=build /project/lib/types /
FROM scratch AS test
COPY --link --from=test-build /project/out/test /
FROM scratch AS test-integration
COPY --link --from=test-integration-build /workspace/cjs-project/junit.xml /cjs-project.junit.xml
COPY --link --from=test-integration-build /workspace/esm-project/junit.xml /esm-project.junit.xml