Skip to content

Commit 9c22c2d

Browse files
authored
feat: added docker images for namadillo and faucet interface (#1105)
1 parent 026b971 commit 9c22c2d

File tree

10 files changed

+255
-11
lines changed

10 files changed

+255
-11
lines changed

.github/workflows/docker.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Docker 🐳
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- main
11+
12+
env:
13+
GIT_LFS_SKIP_SMUDGE: 1
14+
15+
permissions:
16+
id-token: write
17+
contents: write
18+
packages: write
19+
20+
jobs:
21+
docker:
22+
runs-on: ubuntu-latest
23+
strategy:
24+
fail-fast: true
25+
matrix:
26+
images:
27+
- path: "docker/namadillo/Dockerfile"
28+
tag: "namadillo"
29+
- path: "docker/faucet/Dockerfile"
30+
tag: "faucet-interface"
31+
32+
steps:
33+
- name: Checkout repo
34+
uses: actions/checkout@v4
35+
- name: Set up QEMU
36+
uses: docker/setup-qemu-action@v3
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v3
39+
- name: Login to GHCR
40+
uses: docker/login-action@v3
41+
with:
42+
registry: ghcr.io
43+
username: ${{ github.repository_owner }}
44+
password: ${{ secrets.GITHUB_TOKEN }}
45+
- name: Build and Push docker image
46+
uses: docker/build-push-action@v3
47+
with:
48+
context: .
49+
file: ${{ matrix.images.path }}
50+
push: ${{ github.ref == 'refs/heads/main' }}
51+
tags: ${{ matrix.images.tag }}-latest, ${{ matrix.images.tag }}-main
52+
cache-from: type=gha
53+
cache-to: type=gha,mode=max

apps/faucet/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
"@cosmjs/encoding": "^0.29.0",
2020
"buffer": "^6.0.3",
2121
"dompurify": "^3.0.5",
22+
"ethers": "6.7.1",
23+
"framer-motion": "^11.5.4",
2224
"node-forge": "^1.3.1",
2325
"react": "^18.3.0",
2426
"react-dom": "^18.3.0",
@@ -34,24 +36,31 @@
3436
"@types/react": "^18.3.5",
3537
"@types/react-dom": "^18.3.0",
3638
"@types/styled-components": "^5.1.26",
39+
"copy-webpack-plugin": "^12.0.2",
40+
"crypto-browserify": "^3.12.0",
41+
"css-loader": "^7.1.2",
3742
"dotenv": "^16.0.3",
3843
"eslint": "^8.57.0",
3944
"eslint-config-prettier": "^9.1.0",
4045
"eslint-import-resolver-typescript": "^3.6.3",
4146
"eslint-plugin-import": "^2.30.0",
4247
"eslint-plugin-react": "^7.35.2",
4348
"eslint-plugin-react-hooks": "^4.6.0",
49+
"file-loader": "^6.2.0",
4450
"html-webpack-plugin": "^5.6.0",
4551
"local-cors-proxy": "^1.1.0",
52+
"path-browserify": "^1.0.1",
4653
"postcss": "^8.4.32",
4754
"postcss-loader": "^8.1.0",
4855
"postcss-preset-env": "^9.3.0",
56+
"style-loader": "^4.0.0",
4957
"tailwindcss": "^3.4.1",
5058
"ts-loader": "^9.3.1",
5159
"ts-node": "^10.9.1",
5260
"tsconfig-paths-webpack-plugin": "^4.1.0",
5361
"typescript": "^5.5.4",
5462
"typescript-plugin-styled-components": "^2.0.0",
63+
"vm-browserify": "^1.1.2",
5564
"webpack": "^5.9.4",
5665
"webpack-cli": "^4.10.0",
5766
"webpack-dev-server": "^4.11.1"

docker/faucet/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM rust:1.79 AS builder
2+
WORKDIR /app
3+
4+
RUN apt update && apt install -y nodejs npm clang pkg-config libssl-dev protobuf-compiler curl
5+
RUN npm install -g yarn
6+
7+
COPY .yarnrc.yml tsconfig.base.json package.json yarn.lock .
8+
COPY ./.yarn ./.yarn
9+
COPY ./packages ./packages
10+
COPY ./scripts ./scripts
11+
COPY ./apps/faucet/package.json ./apps/faucet/package.json
12+
13+
RUN yarn
14+
15+
WORKDIR /app/apps/faucet
16+
17+
COPY ./apps/faucet .
18+
RUN yarn
19+
RUN yarn build
20+
21+
FROM nginx:alpine
22+
23+
COPY --from=builder /app/apps/faucet/build /usr/share/nginx/html
24+
COPY ./docker/faucet/nginx.conf /etc/nginx/conf.d/default.conf
File renamed without changes.
File renamed without changes.
Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
1-
FROM rust:1.79 as builder
1+
FROM rust:1.79 AS builder
22
WORKDIR /app
3+
34
RUN apt update && apt install -y nodejs npm clang pkg-config libssl-dev protobuf-compiler curl
45
RUN npm install -g yarn
6+
57
RUN rustup target add wasm32-unknown-unknown
68
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -y
9+
710
COPY .yarnrc.yml tsconfig.base.json package.json yarn.lock .
811
COPY ./.yarn ./.yarn
912
COPY ./packages ./packages
1013
COPY ./scripts ./scripts
1114
COPY ./apps/namadillo/package.json ./apps/namadillo/package.json
15+
1216
RUN yarn
17+
1318
WORKDIR /app/apps/namadillo
1419
COPY ./apps/namadillo/scripts ./scripts
20+
1521
RUN yarn wasm:build
22+
1623
COPY ./apps/namadillo .
17-
RUN yarn
18-
RUN yarn build
24+
RUN yarn && yarn build
1925

2026
FROM nginx:alpine
27+
WORKDIR /app
28+
2129
COPY --from=builder /app/apps/namadillo/dist /usr/share/nginx/html
22-
COPY ./docker/namadillo-nginx.conf /etc/nginx/conf.d/default.conf
23-
COPY ./docker/namadillo.config.tom[l] /usr/share/nginx/html/config.toml
30+
COPY ./docker/namadillo/nginx.conf /etc/nginx/conf.d/default.conf
31+
# COPY ./docker/namadillo/config.tom[l] /usr/share/nginx/html/config.toml
32+
COPY --chmod=0755 ./docker/namadillo/bootstrap_config.sh /docker-entrypoint.d/bootstrap_config.sh
33+
34+
RUN chown nginx:nginx /docker-entrypoint.d/bootstrap_config.sh

docker/namadillo/bootstrap_config.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/sh
2+
3+
CONFIG_PATH="/usr/share/nginx/html/config.toml"
4+
5+
# if the config.toml file doesn't exist, we create it and we try to populate it from environemnt variables
6+
# Otherwise we try to replace the settings from environemnt variables
7+
if [ ! -f $CONFIG_PATH ]; then
8+
echo "Bootstrapping new configuration file at $CONFIG_PATH"
9+
touch $CONFIG_PATH
10+
if [[ -n $INDEXER_URL ]]; then
11+
echo "indexer_url = \"${INDEXER_URL}\"" >> $CONFIG_PATH
12+
fi
13+
if [[ -n $RPC_URL ]]; then
14+
echo "rpc_url = \"${RPC_URL}\"" >> $CONFIG_PATH
15+
fi
16+
else
17+
echo "Using configuration file at $CONFIG_PATH"
18+
if [[ -n $INDEXER_URL ]]; then
19+
sed -r -i "s~#?indexer_url = .*~indexer_url = \"${INDEXER_URL}\"~g" $CONFIG_PATH
20+
fi
21+
if [[ -n $RPC_URL ]]; then
22+
sed -r -i "s~#?rpc_url = .*~rpc_url = \"${RPC_URL}\"~g" $CONFIG_PATH
23+
fi
24+
cat $CONFIG_PATH
25+
fi

docker/namadillo/nginx.conf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
location / {
5+
root /usr/share/nginx/html;
6+
index index.html index.htm;
7+
try_files $uri $uri/ $uri.html /index.html;
8+
}
9+
gzip on;
10+
gzip_types text/plain text/css application/javascript application/json application/vnd.ms-fontobject application/xml+rss application/atom+xml font/opentype font/ttf image/svg+xml;
11+
}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
"lint": "wsrun -l --exclude-missing -c lint",
2222
"lint:fix": "wsrun -l --exclude-missing -c lint:fix",
2323
"lint:ci": "wsrun -l --exclude-missing -c lint:ci",
24-
"prepare": "husky install"
24+
"prepare": "husky install",
25+
"docker-build-faucet": "docker build -f docker/faucet/Dockerfile .",
26+
"docker-build-namadillo": "docker build -f docker/namadillo/Dockerfile ."
2527
},
2628
"devDependencies": {
2729
"@release-it/conventional-changelog": "^8.0.1",

0 commit comments

Comments
 (0)