Skip to content

Commit 27eb0dd

Browse files
authored
Speed up docker build time (#244)
Layering npm install vs build to improve build time
1 parent a01be99 commit 27eb0dd

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ FROM registry.access.redhat.com/ubi8/nodejs-16:1 as web-builder
33
WORKDIR /opt/app-root
44

55
COPY --chown=default Makefile Makefile
6+
COPY --chown=default web/package.json web/package.json
7+
COPY --chown=default web/package-lock.json web/package-lock.json
8+
RUN NPM_INSTALL=ci make install-frontend
9+
610
COPY --chown=default web web
711
COPY mocks mocks
8-
9-
RUN NPM_INSTALL=ci make build-frontend
12+
RUN make fmt-frontend just-build-frontend
1013

1114
FROM registry.access.redhat.com/ubi8/go-toolset:1.17 as go-builder
1215

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,14 @@ build-backend: fmt-backend
8989
@echo "### Building backend"
9090
go build ${BUILD_FLAGS} -mod vendor -o plugin-backend cmd/plugin-backend.go
9191

92-
.PHONY: build-frontend
93-
build-frontend: install-frontend fmt-frontend
92+
.PHONY: just-build-frontend
93+
just-build-frontend:
9494
@echo "### Building frontend"
9595
cd web && npm run build
9696

97+
.PHONY: build-frontend
98+
build-frontend: install-frontend fmt-frontend just-build-frontend
99+
97100
.PHONY: build-frontend-standalone
98101
build-frontend-standalone: install-frontend fmt-frontend
99102
@echo "### Building frontend standalone"

0 commit comments

Comments
 (0)