I follow to this reference to reduce my docker image. This is my Dockerfile:
FROM node:10 as builder
RUN curl -sfL https://install.goreleaser.com/github.com/tj/node-prune.sh | bash -s -- -b /usr/local/bin
WORKDIR /app
COPY package.json /app
RUN npm install
COPY . .
RUN npm run build
RUN npm prune --production
RUN /usr/local/bin/node-prune
FROM node:10-alpine
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist /app/
EXPOSE 3000
CMD npm run start:dev
However when run docker build I got the error. Thank for your attention.
2
Answers
Use below lines:
The curl command uses
-s
(--silent
) which is suppressing a failure to get the install script since that URL is dead and node-prune no longer uses goreleaser.Adding the curl
-S
(--show-error
) option will ensure errors are raised:Install
Official node-prune install instructions use
gobinaries.com
:Alternatively since curl is not in base Docker Alpine images you can use
wget
:The default install location is
/usr/local/bin
but can usePREFIX
var to change that: