Skip to content

Commit 90b95ad

Browse files
add a docker and fix errors
1 parent c3bb8db commit 90b95ad

File tree

5 files changed

+80
-13
lines changed

5 files changed

+80
-13
lines changed

Dockerfile

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Build stage
2+
FROM node:20-slim AS builder
3+
4+
WORKDIR /app
5+
6+
# Copy package.json and package-lock.json first
7+
COPY app/package*.json ./
8+
9+
# Install dependencies
10+
RUN npm install
11+
12+
# Copy the rest of the application code
13+
COPY app/ ./
14+
15+
# Build the Next.js app
16+
RUN npm run build
17+
18+
# Runtime stage
19+
FROM node:20-slim AS runner
20+
21+
WORKDIR /app
22+
23+
# Install system dependencies and Foundry (for cast and chisel)
24+
RUN apt-get update && apt-get install -y \
25+
curl \
26+
git \
27+
jq \
28+
&& curl -L https://foundry.paradigm.xyz | bash \
29+
&& ~/.foundry/bin/foundryup \
30+
&& ln -s ~/.foundry/bin/cast /usr/local/bin/cast \
31+
&& ln -s ~/.foundry/bin/chisel /usr/local/bin/chisel \
32+
&& apt-get clean \
33+
&& rm -rf /var/lib/apt/lists/*
34+
35+
# Copy the shell script and make it executable
36+
COPY safe_hashes.sh ../
37+
RUN chmod +x ../safe_hashes.sh
38+
39+
# Copy built app from builder stage
40+
COPY --from=builder /app/.next ./.next
41+
COPY --from=builder /app/public ./public
42+
COPY --from=builder /app/package*.json ./
43+
COPY --from=builder /app/next.config.js ./
44+
45+
# Install production dependencies only
46+
RUN npm install --production
47+
48+
# Expose the port the app runs on
49+
EXPOSE 3000
50+
51+
# Start the app
52+
CMD ["npm", "start"]

app/app/how-it-works/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export default function HowItWorks() {
127127
Ensure that hashes match the ones displayed on your signing device.
128128
</li>
129129
<li>
130-
If you see more than one transaction with the same nonce, ensure it is exclusively because you're trying to replace a transaction. If this is not the case, something unintended is happening.
130+
If you see more than one transaction with the same nonce, ensure it is exclusively because you&apos;re trying to replace a transaction. If this is not the case, something unintended is happening.
131131
</li>
132132
</ol>
133133
</CardContent>

app/components/animated-background.tsx

+15-11
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,14 @@ const AnimatedBackground: React.FC = () => {
3838
size: number
3939
speedX: number
4040
speedY: number
41+
canvasWidth: number
42+
canvasHeight: number
4143

4244
constructor() {
43-
this.x = Math.random() * canvas.width
44-
this.y = Math.random() * canvas.height
45+
this.canvasWidth = canvas?.width || window.innerWidth
46+
this.canvasHeight = canvas?.height || window.innerHeight
47+
this.x = Math.random() * this.canvasWidth
48+
this.y = Math.random() * this.canvasHeight
4549
this.size = Math.random() * 5 + 1
4650
this.speedX = (Math.random() * 1.5 - 0.75) * 0.75
4751
this.speedY = (Math.random() * 1.5 - 0.75) * 0.75
@@ -51,23 +55,23 @@ const AnimatedBackground: React.FC = () => {
5155
this.x += this.speedX
5256
this.y += this.speedY
5357

54-
if (this.x > canvas.width) this.x = 0
55-
else if (this.x < 0) this.x = canvas.width
58+
if (this.x > this.canvasWidth) this.x = 0
59+
else if (this.x < 0) this.x = this.canvasWidth
5660

57-
if (this.y > canvas.height) this.y = 0
58-
else if (this.y < 0) this.y = canvas.height
61+
if (this.y > this.canvasHeight) this.y = 0
62+
else if (this.y < 0) this.y = this.canvasHeight
5963
}
6064

6165
draw() {
6266
// Use different colors for dark and light modes with reduced opacity for light mode
63-
ctx.fillStyle = isDark
67+
ctx!.fillStyle = isDark
6468
? "rgba(255, 255, 255, 0.3)"
6569
: "rgba(0, 0, 0, 0.3)" // Reduced opacity for light mode
6670

67-
ctx.beginPath()
68-
ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2)
69-
ctx.closePath()
70-
ctx.fill()
71+
ctx!.beginPath()
72+
ctx!.arc(this.x, this.y, this.size, 0, Math.PI * 2)
73+
ctx!.closePath()
74+
ctx!.fill()
7175
}
7276
}
7377

app/components/ui/disclaimer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function Disclaimer({
5656
</a>{" "}
5757
whenever possible.
5858
<br /><br />
59-
OpenZeppelin doesn't take responsibility for any incident resulting from the use of this tool.
59+
OpenZeppelin doesn&apos;t take responsibility for any incident resulting from the use of this tool.
6060
</DialogDescription>
6161
</DialogContent>
6262
</Dialog>

docker-compose.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: '3.8'
2+
3+
services:
4+
app:
5+
build: .
6+
ports:
7+
- "3000:3000"
8+
environment:
9+
- NODE_ENV=production
10+
- NEXT_PUBLIC_BASE_URL=http://localhost:3000
11+
restart: unless-stopped

0 commit comments

Comments
 (0)