-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
64 lines (41 loc) · 1.06 KB
/
Dockerfile
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# syntax=docker/dockerfile:1
ARG NODE_VERSION=20.6.1
# ===
# base node image
# ===
FROM node:${NODE_VERSION}-slim as base
RUN apt-get update -qq && \
apt-get install -y openssl curl
LABEL fly_launch_runtime="Remix/Prisma"
WORKDIR /app
ENV NODE_ENV=production
# ===
# Build the app
# ===
FROM base as build
# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install -y python-is-python3 pkg-config build-essential
# Install node modules
COPY --link package.json package-lock.json ./
RUN npm install --production=false
# Generate Prisma Client
COPY --link prisma .
RUN npx prisma generate
# Copy application code
COPY --link . .
# Generate Routes
RUN npx tsx generate-remix-routes.ts
# Generate SVGs
RUN npx tsx generate-svg-icons-sprite.ts
# Build application
RUN npm run build
# Remove development dependencies
RUN npm prune --production
# ===
# Final stage for app image
# ===
FROM base
# Copy built application
COPY --from=build /app /app
CMD npx prisma migrate deploy && node --max-old-space-size=256 build/server