Skip to content

Commit 203213f

Browse files
authored
Build frontend during docker build (louislam#634)
Merged @Jamie-'s pull request that builds the frontend during docker build.
2 parents e31f766 + 9217054 commit 203213f

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

.dockerignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ tmp
99

1010
# Docker extra
1111
docker
12-
frontend
1312
.editorconfig
1413
.eslintrc.cjs
1514
.git
1615
.gitignore
17-
README.md
16+
.github
17+
*.md

compose.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
services:
22
dockge:
33
image: louislam/dockge:1
4+
build:
5+
context: .
6+
dockerfile: docker/Dockerfile
47
restart: unless-stopped
58
ports:
69
# Host Port : Container Port

docker/Dockerfile

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,19 @@
44
FROM louislam/dockge:build-healthcheck AS build_healthcheck
55

66
############################################
7-
# Build
7+
# Build frontend
88
############################################
9-
FROM louislam/dockge:base AS build
9+
FROM louislam/dockge:base AS build_frontend
10+
WORKDIR /app
11+
COPY --chown=node:node . .
12+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
13+
pnpm install && \
14+
pnpm run build:frontend
15+
16+
############################################
17+
# Install node modules
18+
############################################
19+
FROM louislam/dockge:base AS build_nodemodules
1020
WORKDIR /app
1121
COPY --chown=node:node ./package.json ./package.json
1222
COPY --chown=node:node ./package-lock.json ./package-lock.json
@@ -18,8 +28,9 @@ RUN npm ci --omit=dev
1828
FROM louislam/dockge:base AS release
1929
WORKDIR /app
2030
COPY --chown=node:node --from=build_healthcheck /app/extra/healthcheck /app/extra/healthcheck
21-
COPY --from=build /app/node_modules /app/node_modules
22-
COPY --chown=node:node . .
31+
COPY --from=build_frontend /app/frontend-dist /app/frontend-dist
32+
COPY --from=build_nodemodules /app/node_modules /app/node_modules
33+
COPY --chown=node:node . .
2334
RUN mkdir ./data
2435

2536

0 commit comments

Comments
 (0)