forked from OpenZeppelin/safe-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
52 lines (39 loc) · 1.16 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
# Build stage
FROM node:20-slim AS builder
WORKDIR /app
# Copy package.json and package-lock.json first
COPY app/package*.json ./
# Install dependencies
RUN npm install
# Copy the rest of the application code
COPY app/ ./
# Build the Next.js app
RUN npm run build
# Runtime stage
FROM node:20-slim AS runner
WORKDIR /app
# Install system dependencies and Foundry (for cast and chisel)
RUN apt-get update && apt-get install -y \
curl \
git \
jq \
&& curl -L https://foundry.paradigm.xyz | bash \
&& ~/.foundry/bin/foundryup \
&& ln -s ~/.foundry/bin/cast /usr/local/bin/cast \
&& ln -s ~/.foundry/bin/chisel /usr/local/bin/chisel \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy the shell script and make it executable
COPY safe_hashes.sh ../
RUN chmod +x ../safe_hashes.sh
# Copy built app from builder stage
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/next.config.js ./
# Install production dependencies only
RUN npm install --production
# Expose the port the app runs on
EXPOSE 3000
# Start the app
CMD ["npm", "start"]