Skip to content

Commit

Permalink
🚧 Switch back to bun again
Browse files Browse the repository at this point in the history
  • Loading branch information
KONFeature committed May 28, 2024
1 parent 0d25ab4 commit fff3efd
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 8,848 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@
node_modules/
.ponder/

# Some git or prebuild stuff
.git
.gitignore
*.md
dist

# sst
.sst
50 changes: 20 additions & 30 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,42 +1,32 @@
# use the official Bun image
# see all versions at https://hub.docker.com/r/oven/bun/tags
FROM node:22-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable

# Install pnpm
RUN corepack enable pnpm
FROM oven/bun:1-debian as base
WORKDIR /usr/src/app
COPY . .

# install dependencies into temp directory
# this will cache them and speed up future builds
FROM base AS install
# install python and all the stuff required to build sqlite3
RUN apt-get update
RUN apt-get install -y \
python3 \
make \
gcc \
g++
RUN rm -rf /var/lib/apt/lists/*

# Copy the app
COPY . /app
WORKDIR /app

# Remove some stuff
RUN rm -rf node_modules/
RUN rm -rf .ponder/

# Delete package.json, since dependencies could be different in the AWS env
RUN rm -rf package-lock.yaml
build-essential
# Install dependencies
RUN mkdir -p /temp/dev
COPY package.json bun.lockb /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile --ignore-scripts

# Run the prod install
RUN pnpm install
# install with --production (exclude devDependencies)
RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production --ignore-scripts

# Run the code generation step
# todo: Normally it should be done on the dev side before pushing
#FROM base AS build
#RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
#RUN pnpm run codegen
# copy production dependencies and source code into final image
FROM base AS release
COPY --from=install /temp/prod/node_modules node_modules

# run the app
USER bun
EXPOSE 42069/tcp
ENTRYPOINT [ "pnpm", "run", "start" ]
ENTRYPOINT [ "bun", "run", "start" ]
Binary file added bun.lockb
Binary file not shown.
Loading

0 comments on commit fff3efd

Please sign in to comment.