generated from alecodes/base-template
refactor!: update dockerfile build
This commit is contained in:
parent
c535ee2765
commit
d5e488662f
1 changed files with 2 additions and 12 deletions
14
Dockerfile
14
Dockerfile
|
|
@ -10,16 +10,6 @@ FROM bun AS js-deps
|
|||
COPY package.json bun.lock /temp/dev/
|
||||
RUN cd /temp/dev && bun install --frozen-lockfile
|
||||
|
||||
# copy node_modules from temp directory
|
||||
# then copy all (non-ignored) project files into the image
|
||||
FROM bun AS js-bundler
|
||||
COPY --from=js-deps /temp/dev/node_modules node_modules
|
||||
COPY frontend frontend
|
||||
COPY .devfiles/scripts/build-frontend.ts .devfiles/scripts/build-frontend.ts
|
||||
|
||||
ENV NODE_ENV=production
|
||||
RUN bun ./.devfiles/scripts/build-frontend.ts
|
||||
|
||||
# ── Rust ────────────────────────────────────────────────────────────────
|
||||
|
||||
FROM rust:slim AS builder
|
||||
|
|
@ -36,9 +26,9 @@ RUN adduser \
|
|||
--uid 10001 \
|
||||
appuser
|
||||
|
||||
COPY --from=js-bundler /usr/src/app/dist dist
|
||||
|
||||
COPY . .
|
||||
COPY --from=js-deps /usr/local/bin/bun /usr/local/bin/bun
|
||||
COPY --from=js-deps /temp/dev/node_modules node_modules
|
||||
|
||||
RUN --mount=type=cache,target=/app/target/ \
|
||||
--mount=type=cache,target=/usr/local/cargo/git/db \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue