Skip to content

Commit 1cd8da1

Browse files
committed
fix: add Dockerfiles & build actions
1 parent d5227ab commit 1cd8da1

File tree

6 files changed

+201
-0
lines changed

6 files changed

+201
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build & Push Container
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
contents: read
14+
packages: write
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- uses: docker/setup-qemu-action@v3
21+
- uses: docker/setup-buildx-action@v3
22+
23+
- name: Login to registry
24+
uses: docker/login-action@v3
25+
with:
26+
username: ${{ secrets.DOCKERHUB_USERNAME }}
27+
password: ${{ secrets.DOCKERHUB_TOKEN }}
28+
29+
- name: Build & push mainnet
30+
uses: docker/build-push-action@v5
31+
with:
32+
context: .
33+
file: ./Dockerfile_mainnet
34+
push: true
35+
platforms: linux/amd64
36+
build-args: |
37+
MORALIS_API_KEY=${{ secrets.MORALIS_API_KEY }}
38+
ALCHEMY_API_KEY=${{ secrets.ALCHEMY_API_KEY }}
39+
tags: |
40+
ratio1/explorer:mainnet
41+
42+
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build & Push Container
2+
3+
on:
4+
push:
5+
branches: [ development ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
contents: read
14+
packages: write
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- uses: docker/setup-qemu-action@v3
21+
- uses: docker/setup-buildx-action@v3
22+
23+
- name: Login to registry
24+
uses: docker/login-action@v3
25+
with:
26+
username: ${{ secrets.DOCKERHUB_USERNAME }}
27+
password: ${{ secrets.DOCKERHUB_TOKEN }}
28+
29+
- name: Build & push devnet
30+
uses: docker/build-push-action@v5
31+
with:
32+
context: .
33+
file: ./Dockerfile_devnet
34+
push: true
35+
platforms: linux/amd64
36+
build-args: |
37+
MORALIS_API_KEY=${{ secrets.MORALIS_API_KEY }}
38+
ALCHEMY_API_KEY=${{ secrets.ALCHEMY_API_KEY }}
39+
tags: |
40+
ratio1/explorer:devnet
41+
42+
- name: Build & push testnet
43+
uses: docker/build-push-action@v5
44+
with:
45+
context: .
46+
file: ./Dockerfile_testnet
47+
push: true
48+
platforms: linux/amd64
49+
build-args: |
50+
MORALIS_API_KEY=${{ secrets.MORALIS_API_KEY }}
51+
ALCHEMY_API_KEY=${{ secrets.ALCHEMY_API_KEY }}
52+
tags: |
53+
ratio1/explorer:testnet

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ yarn-error.log*
3232

3333
# local env files
3434
.env*.local
35+
.env
3536

3637
# vercel
3738
.vercel

Dockerfile_devnet

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## -------- Build stage ----------------------------------------------------
2+
FROM node:18-alpine AS builder
3+
WORKDIR /app
4+
5+
ARG MORALIS_API_KEY
6+
ARG ALCHEMY_API_KEY
7+
8+
COPY package*.json ./
9+
RUN npm ci
10+
11+
COPY . .
12+
13+
ENV NODE_ENV=production \
14+
NEXT_TELEMETRY_DISABLED=1 \
15+
MORALIS_API_KEY=$MORALIS_API_KEY \
16+
ALCHEMY_API_KEY=$ALCHEMY_API_KEY
17+
18+
RUN npm run build:devnet
19+
20+
##
21+
## -------- Runtime stage --------------------------------------------------
22+
##
23+
FROM node:18-slim AS runtime
24+
WORKDIR /app
25+
26+
27+
ENV NODE_ENV=production \
28+
PORT=32101
29+
30+
COPY --from=builder /app/.next/standalone ./
31+
COPY --from=builder /app/.next/static ./.next/static
32+
COPY --from=builder /app/public ./public
33+
34+
EXPOSE 32101
35+
CMD ["node", "server.js"]

Dockerfile_mainnet

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## -------- Build stage ----------------------------------------------------
2+
FROM node:18-alpine AS builder
3+
WORKDIR /app
4+
5+
ARG MORALIS_API_KEY
6+
ARG ALCHEMY_API_KEY
7+
8+
COPY package*.json ./
9+
RUN npm ci
10+
11+
COPY . .
12+
13+
ENV NODE_ENV=production \
14+
NEXT_TELEMETRY_DISABLED=1 \
15+
MORALIS_API_KEY=$MORALIS_API_KEY \
16+
ALCHEMY_API_KEY=$ALCHEMY_API_KEY
17+
18+
RUN npm run build:mainnet
19+
20+
##
21+
## -------- Runtime stage --------------------------------------------------
22+
##
23+
FROM node:18-slim AS runtime
24+
WORKDIR /app
25+
26+
27+
ENV NODE_ENV=production \
28+
PORT=32101
29+
30+
COPY --from=builder /app/.next/standalone ./
31+
COPY --from=builder /app/.next/static ./.next/static
32+
COPY --from=builder /app/public ./public
33+
34+
EXPOSE 32101
35+
CMD ["node", "server.js"]

Dockerfile_testnet

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## -------- Build stage ----------------------------------------------------
2+
FROM node:18-alpine AS builder
3+
WORKDIR /app
4+
5+
ARG MORALIS_API_KEY
6+
ARG ALCHEMY_API_KEY
7+
8+
COPY package*.json ./
9+
RUN npm ci
10+
11+
COPY . .
12+
13+
ENV NODE_ENV=production \
14+
NEXT_TELEMETRY_DISABLED=1 \
15+
MORALIS_API_KEY=$MORALIS_API_KEY \
16+
ALCHEMY_API_KEY=$ALCHEMY_API_KEY
17+
18+
RUN npm run build:testnet
19+
20+
##
21+
## -------- Runtime stage --------------------------------------------------
22+
##
23+
FROM node:18-slim AS runtime
24+
WORKDIR /app
25+
26+
27+
ENV NODE_ENV=production \
28+
PORT=32101
29+
30+
COPY --from=builder /app/.next/standalone ./
31+
COPY --from=builder /app/.next/static ./.next/static
32+
COPY --from=builder /app/public ./public
33+
34+
EXPOSE 32101
35+
CMD ["node", "server.js"]

0 commit comments

Comments
 (0)