isl-vue3/Dockerfile
Annika Merris b75ed20047 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.
2024-02-04 20:00:07 -05:00

31 lines
1,013 B
Docker

# 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
# 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 ./docker/nginx.conf /etc/nginx/nginx.conf
COPY --from=prerelease /app/dist /usr/share/nginx/html