27 lines
747 B
Docker
27 lines
747 B
Docker
FROM oven/bun:latest AS base
|
|
WORKDIR /usr/src/app
|
|
|
|
FROM base AS install
|
|
RUN mkdir -p /temp/dev
|
|
COPY package.json bun.lock /temp/dev/
|
|
RUN cd /temp/dev && bun install --frozen-lockfile
|
|
|
|
# install with --production (exclude devDependencies)
|
|
RUN mkdir -p /temp/prod
|
|
COPY package.json bun.lock /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/dev/node_modules node_modules
|
|
COPY . .
|
|
|
|
RUN bun run build
|
|
|
|
FROM nginx:alpine
|
|
COPY --from=prerelease /usr/src/app/dist /usr/share/nginx/html
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"]
|