-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
27 lines (24 loc) · 805 Bytes
/
Dockerfile
File metadata and controls
27 lines (24 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
FROM oven/bun:1 as base
ENV NODE_ENV=production
WORKDIR /usr/src/app
# install dependencies into temp directory
# this will cache them and speed up future builds
FROM base AS install
RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production
FROM base AS prerelease
COPY --from=install /temp/prod/node_modules node_modules
COPY . .
# RUN bun test
RUN bun run build
FROM base AS release
COPY --from=install /temp/prod/node_modules node_modules
COPY --from=prerelease /usr/src/app/dist/main.js .
COPY --from=prerelease /usr/src/app/package.json .
COPY --from=prerelease /usr/src/app/config config
COPY --from=prerelease /usr/src/app/migrations migrations
RUN chown bun .
USER bun
EXPOSE 5000/tcp
ENTRYPOINT [ "bun", "run", "main.js" ]