diff --git a/Dockerfile b/Dockerfile index 7684efb..7b34b52 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,22 +9,20 @@ WORKDIR /app # install dependencies into temp directory # this will cache them and speed up future builds FROM base as install -# install with --production (exclude devDependencies) -RUN mkdir -p /temp/prod -COPY package.json bun.lockb /temp/prod/ -RUN cd /temp/prod && bun install --frozen-lockfile --production + +RUN mkdir -p /temp/dev +COPY package.json bun.lockb /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 node:21-bookworm AS prerelease -WORKDIR /app - -COPY --from=install /temp/prod/node_modules node_modules +FROM base AS prerelease +COPY --from=install /temp/dev/node_modules node_modules COPY . . -# I don't have any tests, I am bad. +# [optional] tests & build ENV NODE_ENV=production -RUN npx vite build +RUN bunx --bun vite build # Copy the distribution folder into the final image. FROM nginx:stable-alpine as release