isl-vue3/Dockerfile

32 lines
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
# 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 cat -e vite.config.ts
RUN bunx --bun vite build --debug true --logLevel info
# 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