isl-vue3/Dockerfile

35 lines
1.1 KiB
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.0.26-debian as base
WORKDIR /app
# install dependencies into temp directory
# this will cache them and speed up future builds
FROM base as install
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 base AS prerelease
COPY --from=install /temp/dev/node_modules node_modules
COPY . .
# [optional] tests & build
ENV NODE_ENV=production
# I can't run the type checking because of some sort of issue with
# bun and vue-tsc.
# see https://github.com/oven-sh/bun/issues/4754
# RUN bunx --bun vue-tsc --build --force
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