bot-api/Dockerfile

28 lines
752 B
Docker
Raw Normal View History

2023-12-08 13:05:20 +00:00
# Dockerfile
# use the official Bun image
# see all versions at https://hub.docker.com/r/oven/bun/tags
FROM oven/bun:1 as base
WORKDIR /usr/src/app
# install dependencies into temp folder
# 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 --production
# Copy production dependencies and source code into final image
2023-12-08 13:05:20 +00:00
FROM base AS release
COPY --from=install /temp/prod/node_modules node_modules
COPY --from=install /usr/src/app/src ./src
COPY --from=install /usr/src/app/package.json .
2023-12-08 13:05:20 +00:00
# run the app
USER bun
ENV NODE_ENV=production
EXPOSE 8080/tcp
CMD ["bun", "run", "start"]