Dockerfile: fix build 🐛, optimize layer caching
This commit is contained in:
parent
b83d89562d
commit
869bc15ec3
1 changed files with 16 additions and 7 deletions
23
Dockerfile
23
Dockerfile
|
@ -1,22 +1,31 @@
|
||||||
FROM node:alpine as builder
|
FROM node:alpine as builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# install dependencies
|
||||||
RUN apk add --update git bash
|
RUN apk add --update git bash
|
||||||
|
|
||||||
ADD package.json /app
|
ADD package.json /app
|
||||||
RUN npm install --production
|
RUN npm install
|
||||||
|
|
||||||
|
# build documentation
|
||||||
|
ADD . /app
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# ---
|
||||||
|
|
||||||
FROM node:alpine
|
FROM node:alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# install dependencies
|
||||||
|
ADD package.json /app
|
||||||
|
RUN npm install --production
|
||||||
|
|
||||||
|
# add source code
|
||||||
|
ADD . /app
|
||||||
|
COPY --from=builder /app/docs ./docs
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
CMD ["node", "index.js"]
|
CMD ["node", "index.js"]
|
||||||
|
|
Loading…
Reference in a new issue