Skip to content

Commit

Permalink
refractor: quality of life updates for source code (#61)
Browse files Browse the repository at this point in the history
* refractor: update dependencies and script names

* refractor: re-enable transpilation step
  • Loading branch information
fabio-nettis authored May 2, 2024
1 parent 8692383 commit fbbd5ef
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ COPY --from=install /temp/dev/node_modules node_modules
COPY . .

# reset old database and generate new one
RUN bun run reset
RUN bun run init
RUN bun run db:reset
RUN bun run db:init

# synchronize the database schema & generate client
RUN bunx prisma migrate deploy
Expand All @@ -55,14 +55,17 @@ RUN bun run generate
# test generated source data
RUN bun test

# build the app
RUN bun run app:reset
RUN bun run app:build

# copy production dependencies and source code into final image
FROM base AS release
COPY --from=prerelease /usr/src/app/src src
COPY --from=prerelease /usr/src/app/build build
COPY --from=prerelease /usr/src/app/prisma prisma
COPY --from=prerelease /usr/src/app/databases databases
COPY --from=prerelease /usr/src/app/node_modules node_modules
COPY --from=prerelease /usr/src/app/package.json package.json
COPY --from=prerelease /usr/src/app/tsconfig.json tsconfig.json

# src directory permissions
RUN chown -R bun:bun /usr/src/app
Expand All @@ -73,4 +76,4 @@ ENV NODE_ENV=production
# run the app
USER bun
EXPOSE 3000/tcp
ENTRYPOINT ["bun", "run", "--smol", "src/index.ts"]
ENTRYPOINT ["bun", "run", "--smol", "build/index.mjs"]
Binary file modified bun.lockb
Binary file not shown.
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@
],
"scripts": {
"lint": "eslint . --ext .ts",
"reset": "rm -rf ./databases",
"format": "prettier --write .",
"init": "bun run ./scripts/init.ts",
"db:reset": "rm -rf ./databases",
"db:init": "bun run ./scripts/init.ts",
"dev": "bun run --hot ./src/index.ts",
"refresh": "bun run ./scripts/refresh.ts",
"generate": "bun run ./scripts/generate.ts"
"generate": "bun run ./scripts/generate.ts",
"app:reset": "rm -rf ./build",
"app:build": "bun build ./src/index.ts --minify --entry-naming=\"[name].mjs\" --outdir=\"build\" --sourcemap=\"external\" --target=\"node\""
},
"devDependencies": {
"@types/bun": "latest",
"@types/memory-cache": "^0.2.5",
"@types/qs": "^6.9.12",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
Expand Down

0 comments on commit fbbd5ef

Please sign in to comment.