Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build frontend during docker build #634

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ tmp

# Docker extra
docker
frontend
.editorconfig
.eslintrc.cjs
.git
.gitignore
README.md
.github
*.md
3 changes: 3 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
services:
dockge:
image: louislam/dockge:1
build:
context: .
dockerfile: docker/Dockerfile
restart: unless-stopped
ports:
# Host Port : Container Port
Expand Down
19 changes: 15 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@
FROM louislam/dockge:build-healthcheck AS build_healthcheck

############################################
# Build
# Build frontend
############################################
FROM louislam/dockge:base AS build
FROM louislam/dockge:base AS build_frontend
WORKDIR /app
COPY --chown=node:node . .
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm install && \
pnpm run build:frontend

############################################
# Install node modules
############################################
FROM louislam/dockge:base AS build_nodemodules
WORKDIR /app
COPY --chown=node:node ./package.json ./package.json
COPY --chown=node:node ./pnpm-lock.yaml ./pnpm-lock.yaml
Expand All @@ -18,8 +28,9 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-l
FROM louislam/dockge:base AS release
WORKDIR /app
COPY --chown=node:node --from=build_healthcheck /app/extra/healthcheck /app/extra/healthcheck
COPY --from=build /app/node_modules /app/node_modules
COPY --chown=node:node . .
COPY --from=build_frontend /app/frontend-dist /app/frontend-dist
COPY --from=build_nodemodules /app/node_modules /app/node_modules
COPY --chown=node:node . .
RUN mkdir ./data

VOLUME /app/data
Expand Down
Loading