about summary refs log tree commit diff stats
path: root/Dockerfile
diff options
context:
space:
mode:
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile28
1 files changed, 12 insertions, 16 deletions
diff --git a/Dockerfile b/Dockerfile
index 3ec8e2c..a56ca7b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,26 +2,23 @@
 
 # Adjust BUN_VERSION as desired
 ARG BUN_VERSION=1.0.36
-FROM oven/bun:${BUN_VERSION} as base
+FROM docker.io/oven/bun:${BUN_VERSION} as base
 
 LABEL fly_launch_runtime="Bun"
 
-# Bun app lives here
 WORKDIR /app
 
-# Set production environment
-ENV NODE_ENV="production"
+FROM base as install
+RUN mkdir -p /temp/dev
+COPY --link bun.lockb package.json /temp/dev/
+RUN cd /temp/dev && bun install --frozen-lockfile
 
-# Throw-away build stage to reduce size of final image
-FROM base as build
-
-# # Install packages needed to build node modules
-# RUN apt-get update -qq && \
-#     apt-get install -y build-essential pkg-config python-is-python3
+RUN mkdir -p /temp/prod
+COPY --link bun.lockb package.json /temp/prod/
+RUN cd /temp/prod && bun install --frozen-lockfile --production
 
-# Install node modules
-COPY --link bun.lockb package.json ./
-RUN bun install --ci
+FROM base as build
+COPY --from=install /temp/dev/node_modules node_modules
 
 # Copy application code
 COPY --link config.toml config.toml
@@ -31,10 +28,8 @@ COPY --link content content
 COPY --link templates templates
 COPY --link static static
 
-RUN ./bin/build.ts && rm -r node_modules
-
 ENV NODE_ENV=production
-RUN [ "bun", "install", "--production", "--ci" ]
+RUN bun run bin/build.ts
 
 FROM alpine:20240329 as postprocess
 
@@ -56,6 +51,7 @@ FROM base
 
 # Copy built application
 COPY config.toml /app/
+COPY --from=install /temp/prod/node_modules node_modules
 COPY --from=build /app /app
 COPY --from=postprocess /app/public /app/