mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 21:21:02 +00:00
ci: utilize npm cache for faster docker builds
This commit is contained in:
parent
f047b8180a
commit
54b04b814e
1 changed files with 12 additions and 3 deletions
15
Dockerfile
15
Dockerfile
|
|
@ -1,3 +1,5 @@
|
||||||
|
# syntax=docker/dockerfile:1.5
|
||||||
|
|
||||||
FROM scratch as ignore
|
FROM scratch as ignore
|
||||||
|
|
||||||
WORKDIR /listory
|
WORKDIR /listory
|
||||||
|
|
@ -17,7 +19,9 @@ FROM common as build-api
|
||||||
LABEL stage="build-api"
|
LABEL stage="build-api"
|
||||||
|
|
||||||
COPY *.json /app/
|
COPY *.json /app/
|
||||||
RUN npm ci
|
RUN --mount=type=cache,target=/home/root/.npm \
|
||||||
|
npm set cache /usr/src/app/.npm && \
|
||||||
|
npm ci
|
||||||
|
|
||||||
COPY src/ /app/src/
|
COPY src/ /app/src/
|
||||||
RUN NODE_ENV=production npm run build
|
RUN NODE_ENV=production npm run build
|
||||||
|
|
@ -33,7 +37,10 @@ ARG VERSION=unknown
|
||||||
WORKDIR /app/frontend
|
WORKDIR /app/frontend
|
||||||
|
|
||||||
COPY frontend/package*.json /app/frontend/
|
COPY frontend/package*.json /app/frontend/
|
||||||
RUN npm ci
|
RUN --mount=type=cache,target=/home/root/.npm \
|
||||||
|
npm set cache /usr/src/app/.npm && \
|
||||||
|
npm ci
|
||||||
|
|
||||||
|
|
||||||
COPY frontend/ /app/frontend/
|
COPY frontend/ /app/frontend/
|
||||||
RUN NODE_ENV=production npm run build
|
RUN NODE_ENV=production npm run build
|
||||||
|
|
@ -55,7 +62,9 @@ WORKDIR /app
|
||||||
|
|
||||||
COPY package.json /app/
|
COPY package.json /app/
|
||||||
COPY package-lock.json /app/
|
COPY package-lock.json /app/
|
||||||
RUN npm ci --omit=dev
|
RUN --mount=type=cache,target=/home/root/.npm \
|
||||||
|
npm set cache /usr/src/app/.npm && \
|
||||||
|
npm ci --omit=dev
|
||||||
|
|
||||||
COPY --from=build-api /app/dist/ /app/dist/
|
COPY --from=build-api /app/dist/ /app/dist/
|
||||||
COPY --from=build-frontend /app/frontend/build /app/static/
|
COPY --from=build-frontend /app/frontend/build /app/static/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue