build(server): use github-action cache (#949)

* build(server): prune dependencies in docker builder

* fix: e2e tests

* refactor: dockerfile step order

* fix: vips build dependency

* feat: use caching
This commit is contained in:
Jason Rasmussen
2022-11-09 20:53:21 -05:00
committed by GitHub
parent b457bfbd4e
commit cc61729f01
6 changed files with 41 additions and 34 deletions

View File

@@ -2,33 +2,32 @@ FROM node:16-alpine3.14 as builder
WORKDIR /usr/src/app
RUN apk add --update-cache build-base python3 libheif vips-dev ffmpeg
COPY package.json package-lock.json ./
RUN apk add --update-cache build-base python3 libheif vips-dev ffmpeg
RUN npm ci
COPY . .
RUN npm run build
RUN npm prune --omit=dev
# Prod stage
FROM node:16-alpine3.14
WORKDIR /usr/src/app
COPY LICENSE /licenses/LICENSE.txt
COPY LICENSE /LICENSE
COPY package.json package-lock.json ./
COPY start-server.sh start-microservices.sh ./
RUN mkdir -p /usr/src/app/dist \
&& apk add --no-cache libheif vips ffmpeg
RUN apk add --no-cache libheif vips ffmpeg
COPY --from=builder /usr/src/app/node_modules ./node_modules
COPY --from=builder /usr/src/app/dist ./dist
COPY --from=builder /usr/src/app/bin ./bin
RUN npm prune --production
COPY LICENSE /licenses/LICENSE.txt
COPY LICENSE /LICENSE
COPY package.json package-lock.json ./
COPY start-server.sh start-microservices.sh ./
VOLUME /usr/src/app/upload