-
-
Notifications
You must be signed in to change notification settings - Fork 481
Expand file tree
/
Copy pathDockerfile.preview
More file actions
44 lines (29 loc) · 991 Bytes
/
Dockerfile.preview
File metadata and controls
44 lines (29 loc) · 991 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# syntax = docker/dockerfile:1
FROM oven/bun:1.3.10 AS base
LABEL fly_launch_runtime="React Router"
# App lives here
WORKDIR /app
# Set production environment
ENV NODE_ENV="production"
# Throw-away build stage to reduce size of final image
FROM base AS build
# Cache-busting arg - changes on each commit
ARG COMMIT_SHA
# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential pkg-config python-is-python3
# Copy source code
COPY . .
# Install packages
RUN bun install
RUN echo "VITE_SITE_VARIANT=\"preview\"" >> .env
# Build application (skip tsc type checking - already done in CI)
RUN bun run build:shared && bun run build:themes && bun run build:components && bun run build:vite
# Final stage for app image
FROM base
# Copy built application
COPY --from=build /app /app
# Start the server by default, this can be overwritten at runtime
ENV PORT=3000
EXPOSE 3000
CMD [ "bun", "./server.js" ]