2021-04-20 15:28:53 -07:00
|
|
|
npm-base:
|
|
|
|
FROM alpine:3.13.5
|
|
|
|
RUN apk add --update nodejs npm
|
2022-04-18 18:30:58 -07:00
|
|
|
COPY ./package.json ./
|
|
|
|
COPY ./package-lock.json ./
|
|
|
|
RUN npm install
|
|
|
|
# Output these back in case npm install changes them.
|
|
|
|
SAVE ARTIFACT package.json AS LOCAL ./package.json
|
|
|
|
SAVE ARTIFACT package-lock.json AS LOCAL ./package-lock.json
|
2021-04-20 15:28:53 -07:00
|
|
|
|
|
|
|
code:
|
|
|
|
FROM +npm-base
|
|
|
|
WORKDIR /code
|
|
|
|
COPY package.json package-lock.json .
|
|
|
|
RUN npm ci
|
|
|
|
COPY --dir src .
|
|
|
|
|
|
|
|
lint:
|
|
|
|
FROM +code
|
2022-04-18 18:30:58 -07:00
|
|
|
COPY .eslintrc.js .
|
|
|
|
RUN npm run-script lint
|
2021-04-20 15:28:53 -07:00
|
|
|
|
|
|
|
compile:
|
|
|
|
FROM +code
|
|
|
|
WORKDIR /code
|
|
|
|
RUN npm ci
|
2022-04-18 18:30:58 -07:00
|
|
|
COPY tsconfig.json .
|
|
|
|
RUN npm run-script package
|
2021-04-20 15:28:53 -07:00
|
|
|
SAVE ARTIFACT dist AS LOCAL dist
|
|
|
|
SAVE ARTIFACT node_modules AS LOCAL node_modules
|
|
|
|
|
2022-04-18 18:30:58 -07:00
|
|
|
test:
|
|
|
|
FROM +code
|
|
|
|
COPY tsconfig.json .
|
|
|
|
COPY jest.config.js .
|
|
|
|
RUN npm test
|
|
|
|
|
2021-04-20 15:28:53 -07:00
|
|
|
all:
|
|
|
|
BUILD +lint
|
|
|
|
BUILD +compile
|
2022-04-18 18:30:58 -07:00
|
|
|
BUILD +test
|