forked from stoplightio/spectral
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
37 lines (23 loc) · 1011 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
FROM node:12 as compiler
WORKDIR /usr/src/spectral
COPY package.json tsconfig.rollup.json rollup.config.js yarn.lock tsconfig.build.json tsconfig.json /usr/src/spectral/
COPY scripts/ /usr/src/spectral/scripts
COPY src/ /usr/src/spectral/src/
RUN yarn && yarn build
###############################################################
FROM node:12 as dependencies
WORKDIR /usr/src/spectral/
COPY package.json /usr/src/spectral/
ENV NODE_ENV production
RUN yarn --production
RUN curl -sfL https://install.goreleaser.com/github.com/tj/node-prune.sh | bash
RUN ./bin/node-prune
###############################################################
FROM node:12-alpine
ENV NODE_ENV production
COPY package.json /usr/src/spectral/
COPY --from=compiler /usr/src/spectral/dist /usr/src/spectral/dist
COPY --from=dependencies /usr/src/spectral/node_modules/ /usr/src/spectral/node_modules/
RUN ln -s /usr/src/spectral/dist/cli/index.js /usr/bin/spectral \
&& chmod +x /usr/bin/spectral
ENTRYPOINT [ "spectral" ]