generated from sripwoud/ts-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
26 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,30 @@ | ||
FROM oven/bun:1 AS base | ||
# FIXME: remapping of ts aliases does not work with bun + nestjs | ||
FROM node:20-alpine as base | ||
WORKDIR /app | ||
COPY package.json . | ||
COPY apps/server/package.json apps/server/ | ||
RUN apk update &&\ | ||
apk upgrade &&\ | ||
apk add --no-cache bash dumb-init &&\ | ||
apk cache clean | ||
|
||
FROM base as install | ||
RUN mkdir -p /temp/dev && mkdir /temp/prod | ||
|
||
COPY *.json /temp/dev/ | ||
COPY apps/server/*.json /temp/dev/apps/server/ | ||
|
||
COPY *.json /temp/prod/ | ||
COPY apps/server/*.json /temp/prod/apps/server/ | ||
|
||
RUN cd /temp/dev &&\ | ||
bun i &&\ | ||
cd /temp/prod &&\ | ||
bun i --production | ||
COPY package.json yarn.lock ./ | ||
COPY apps/server/package.json apps/server/ | ||
RUN yarn install --ignore-scripts --frozen-lockfile --production=false | ||
|
||
FROM base as prerelease | ||
COPY --from=install /temp/dev/node_modules node_modules | ||
COPY --from=install /temp/dev/apps/server/node_modules apps/server/node_modules | ||
FROM install as prerelease | ||
COPY tsconfig.json . | ||
COPY apps/server/tsconfig.* apps/server/ | ||
COPY apps/server/tsconfig* apps/server/nest-cli.json apps/server/ | ||
COPY apps/server/src apps/server/src | ||
|
||
ENV NODE_ENV=production | ||
RUN bun --filter server build | ||
RUN yarn workspace server build &&\ | ||
find -type d -name node_modules -exec rm -fr {} + &&\ | ||
yarn install --frozen-lockfile --production=true | ||
|
||
FROM base as release | ||
COPY --from=install /temp/prod/node_modules node_modules | ||
COPY --from=prerelease /app/apps/server/dist apps/server/dist | ||
|
||
USER bun | ||
COPY --from=prerelease /app/apps/server/node_modules node_modules | ||
COPY --from=prerelease /app/apps/server/dist dist | ||
ENV NODE_ENV production | ||
USER node | ||
# TODO: make this configurable/overridable | ||
EXPOSE 3001 | ||
ENTRYPOINT ["bun", "--filter", "server", "start"] | ||
ENTRYPOINT ["dumb-init", "--"] | ||
CMD ["node", "dist"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"private": true, | ||
"devDependencies": { | ||
"@biomejs/biome": "^1.8.3", | ||
"barrelsby": "^2.8.1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters