Skip to content

Commit

Permalink
change esbuild to tsup (#240)
Browse files Browse the repository at this point in the history
* build: add tsup config

* build: fixup dockerfile

- Update node to version 20.12 and capitalize the AS keyword
- split up common pnpm args into an env
- Install prod node env now tsup doesn't bundle node deps

* build: remove esbuild config
  • Loading branch information
samhwang authored Jul 26, 2024
1 parent b80c418 commit 734f87f
Show file tree
Hide file tree
Showing 5 changed files with 511 additions and 143 deletions.
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
################
# Build assets #
################
FROM node:20.10 as build
FROM node:20.12 AS build
WORKDIR /app

# Install global node modules: pnpm
RUN npm install -g [email protected]
ENV PNPM_ARGS="--frozen-lockfile --ignore-scripts"

# Install Node modules
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --ignore-scripts
RUN pnpm install ${PNPM_ARGS}

# Generate Prisma schemas
COPY prisma ./prisma
Expand All @@ -19,11 +20,12 @@ COPY . .

ENV NODE_ENV=production
RUN pnpm build
RUN pnpm install --production ${PNPM_ARGS}

####################
# Production image #
####################
FROM node:20.10-slim as production
FROM node:20.12-slim AS production
WORKDIR /app

RUN set -xe && \
Expand All @@ -34,6 +36,7 @@ RUN set -xe && \
rm -rf /var/lib/apt/lists/* /usr/share/man/* /usr/share/doc/*

COPY --chown=node:node --from=build /app/build build
COPY --chown=node:node --from=build /app/node_modules node_modules

USER node
ENV NODE_ENV=production
Expand Down
74 changes: 0 additions & 74 deletions esbuild.config.ts

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"scripts": {
"prepare": "husky",
"typecheck": "tsc",
"build": "rimraf build && tsx esbuild.config.ts",
"build": "tsup",
"build:typecheck": "pnpm typecheck && pnpm build",
"lint": "biome check .",
"lint:fix": "biome check --write .",
Expand Down Expand Up @@ -74,7 +74,7 @@
"lint-staged": "^15.2.7",
"msw": "^2.3.4",
"prisma": "^5.17.0",
"rimraf": "^6.0.1",
"tsup": "^8.2.3",
"tsx": "^4.16.2",
"typescript": "^5.5.4",
"vitest": "^2.0.4",
Expand Down
Loading

0 comments on commit 734f87f

Please sign in to comment.