mirror of
https://forgejo.merr.is/annika/isl-vue3.git
synced 2025-12-11 12:26:36 -05:00
Modified Dockerfile To Use Bun And Use a Different Build Command
There is a bug, discussed at https://github.com/oven-sh/bun/issues/4754 where running bun for vue-tsc fails for some reason. I am compensating by running `bunx --bun vite build` manually, and ignoring the type checking, since I don't really need that in prod.
This commit is contained in:
parent
d13d93b676
commit
b75ed20047
3 changed files with 58 additions and 8 deletions
32
Dockerfile
32
Dockerfile
|
|
@ -1,11 +1,31 @@
|
|||
FROM oven/bun:1-alpine as build-stage
|
||||
# This is making minimal changes from the guide at
|
||||
# https://bun.sh/guides/ecosystem/docker (as of 2024-02-04)
|
||||
|
||||
# use the official Bun image
|
||||
# see all versions at https://hub.docker.com/r/oven/bun/tags
|
||||
FROM oven/bun:1-alpine as base
|
||||
WORKDIR /app
|
||||
COPY . /app
|
||||
RUN bun install
|
||||
RUN bun run build
|
||||
|
||||
# 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
|
||||
|
||||
# copy node_modules from temp directory
|
||||
# then copy all (non-ignored) project files into the image
|
||||
FROM base AS prerelease
|
||||
COPY --from=install /temp/prod/node_modules node_modules
|
||||
COPY . .
|
||||
|
||||
# I don't have any tests, I am bad.
|
||||
ENV NODE_ENV=production
|
||||
RUN bunx --bun vite build
|
||||
|
||||
# Copy the distribution folder into the final image.
|
||||
FROM nginx:stable-alpine as release
|
||||
|
||||
COPY --from=build-stage /app/docker/nginx.conf /etc/nginx/nginx.conf
|
||||
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
||||
COPY ./docker/nginx.conf /etc/nginx/nginx.conf
|
||||
COPY --from=prerelease /app/dist /usr/share/nginx/html
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue