improve Docker layer caching

This commit is contained in:
Jannis R 2020-05-01 20:17:07 +02:00
parent 509504c7c8
commit 2eb74c000b
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5

View file

@ -1,18 +1,22 @@
FROM node:alpine FROM node:alpine as builder
WORKDIR /app WORKDIR /app
ADD . /app
RUN apk add --update git bash && \ RUN apk add --update git bash
npm install --production && \
apk del git && \ ADD package.json /app
rm -rf /tmp/* /var/cache/apk/* RUN npm install --production
FROM node:alpine
WORKDIR /app
EXPOSE 3000 EXPOSE 3000
ENV HOSTNAME v5.db.transport.rest ENV HOSTNAME v5.db.transport.rest
ENV PORT 3000 ENV PORT 3000
COPY --from=builder /app/node_modules ./node_modules
ADD . /app
RUN npm run build RUN npm run build
CMD ["node", "index.js"] CMD ["node", "index.js"]