Skip to content

Commit eab0b55

Browse files
committed
Reorder tenant-ui Dockerfile so dependency layers cache
Signed-off-by: Lucas ONeil <lucasoneil@gmail.com>
1 parent 0fd934f commit eab0b55

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

services/tenant-ui/Dockerfile

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
FROM node:24-alpine
22

33
WORKDIR /usr/src/app
4-
COPY . .
4+
5+
# Copy only the dependency manifests first so the npm ci layers
6+
# stay cached as long as the lockfiles don't change
7+
COPY package.json package-lock.json ./
8+
COPY frontend/package.json frontend/package-lock.json ./frontend/
9+
510
# install backend libs
6-
RUN npm cache clean --force && npm ci
11+
RUN npm ci
712
# install frontend libs
8-
RUN cd frontend && npm cache clean --force && npm ci
13+
RUN cd frontend && npm ci
14+
15+
# Copy in the source - code changes only invalidate layers from here down
16+
COPY . .
17+
918
# build backend
1019
RUN npm run build
1120
# build frontend
@@ -14,4 +23,4 @@ RUN cd frontend && npm run build
1423
RUN rm -rf frontend/node_modules
1524

1625
EXPOSE 8080
17-
CMD [ "node", "--enable-source-maps", "dist/src/index.js" ]
26+
CMD [ "node", "--enable-source-maps", "dist/src/index.js" ]

0 commit comments

Comments
 (0)