Skip to content

Commit

Permalink
build(repo): use distributed spectral-alpine binary
Browse files Browse the repository at this point in the history
  • Loading branch information
P0lip committed Aug 28, 2021
1 parent d3785a8 commit a885b72
Showing 1 changed file with 6 additions and 31 deletions.
37 changes: 6 additions & 31 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,12 @@
FROM node:12 as compiler
FROM node:16-alpine

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

COPY scripts/install.sh /usr/src/spectral/
RUN ls -l
RUN apk --no-cache add curl
RUN ./install.sh
RUN rm ./install.sh
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" ]

0 comments on commit a885b72

Please sign in to comment.