-
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.
Merge pull request #69 from clearfunction/fix/docker-build
feat: convert to Bun and fix the Docker build
- Loading branch information
Showing
11 changed files
with
72 additions
and
5,789 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
FROM node:14-alpine as builder | ||
FROM oven/bun:1 AS base | ||
WORKDIR /usr/src/app | ||
|
||
ARG NODE_ENV=development | ||
ENV NODE_ENV=${NODE_ENV} | ||
FROM base AS install | ||
RUN mkdir -p /temp/dev | ||
COPY package.json bun.lockb /temp/dev/ | ||
RUN cd /temp/dev && bun install --frozen-lockfile | ||
|
||
WORKDIR /usr/src/app | ||
RUN mkdir -p /temp/prod | ||
COPY package.json bun.lockb /temp/prod/ | ||
RUN cd /temp/prod && bun install --frozen-lockfile --production | ||
|
||
COPY package.json package-lock.json tsconfig.json ./ | ||
RUN npm install | ||
COPY src ./ | ||
RUN npm run tsc | ||
FROM base AS prerelease | ||
COPY --from=install /temp/dev/node_modules node_modules | ||
COPY . . | ||
|
||
FROM node:14-alpine | ||
ENV NODE_ENV=production | ||
RUN bun test | ||
RUN bun run build:prod | ||
|
||
WORKDIR /usr/src/app | ||
COPY --from=builder /usr/src/app/package.json package.json | ||
COPY --from=builder /usr/src/app/node_modules node_modules | ||
COPY --from=builder /usr/src/app/build build | ||
FROM base AS release | ||
COPY --from=install /temp/prod/node_modules node_modules | ||
COPY --from=prerelease /usr/src/app/build/* build/ | ||
COPY --from=prerelease /usr/src/app/package.json . | ||
|
||
CMD [ "npm", "run", "start:prod" ] | ||
# run the app | ||
USER bun | ||
EXPOSE 3000/tcp | ||
ENTRYPOINT [ "bun", "run", "start:prod" ] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// @ts-check | ||
|
||
import eslint from '@eslint/js'; | ||
import tseslint from 'typescript-eslint'; | ||
import eslintConfigPrettier from 'eslint-config-prettier'; | ||
|
||
export default tseslint.config( | ||
eslint.configs.recommended, | ||
...tseslint.configs.strict, | ||
...tseslint.configs.stylistic, | ||
{ | ||
rules: { | ||
'@typescript-eslint/no-empty-object-type': [ | ||
'error', | ||
{ allowInterfaces: 'always' }, | ||
], | ||
}, | ||
ignores: ['dist', 'node_modules'], | ||
}, | ||
eslintConfigPrettier | ||
); |
Oops, something went wrong.