Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Wilson committed Nov 7, 2023
2 parents 3b38c73 + 3c20188 commit 36a88b0
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist
node_modules
README.md
.vscode
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
############################
# Docker build environment #
############################

FROM node:18.16.1-bookworm AS build

WORKDIR /build

COPY . .

RUN npm i
RUN npm run build

############################
# Docker final environment #
############################

FROM caddy:2.7.4-alpine

EXPOSE 80
WORKDIR /var/www/html

COPY --from=build /build/dist/public-pool-ui .
COPY docker/Caddyfile.tpl /etc/Caddyfile.tpl
COPY docker/entrypoint.sh /entrypoint.sh

CMD ["/bin/sh", "/entrypoint.sh"]
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,17 @@ Install pm2 (https://pm2.keymetrics.io/)
```bash
$ pm2 serve --spa dist/public-pool-ui/ 3335 --name ui
```

## Docker

```bash
$ docker build -t public-pool-ui .
$ docker run --name public-pool-ui --rm -p 8080:80 public-pool-ui
```

From Docker commands, website will be accessible on [http://localhost:8080](http://localhost:8080). By default Caddy server listen on port 80, but we bind it to port 8080 which allows you to launch image without root permissions.

Available variables:
* `DOMAIN`: website domain (default: `localhost`)
* `LOGLEVEL`: loglevel in stdout (default: `INFO`)
* `LOGFORMAT`: log format in stdout (default: `json`)
10 changes: 10 additions & 0 deletions docker/Caddyfile.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
http://%%DOMAIN%% {
root * /var/www/html
file_server
log {
output stdout
format %%LOGFORMAT%%
level %%LOGLEVEL%%
}
}
12 changes: 12 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

if [ ! -e "/etc/Caddyfile" ]; then
sed -i "s#%%DOMAIN%%#${DOMAIN:-localhost}#g" /etc/Caddyfile.tpl
sed -i "s#%%LOGLEVEL%%#${LOGLEVEL:-INFO}#g" /etc/Caddyfile.tpl
sed -i "s#%%LOGFORMAT%%#${LOGFORMAT:-json}#g" /etc/Caddyfile.tpl
mv /etc/Caddyfile.tpl /etc/Caddyfile
else
rm -f /etc/Caddyfile.tpl
fi

exec caddy run --config /etc/Caddyfile
4 changes: 2 additions & 2 deletions src/app/components/splash/splash.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ <h4 style="text-align: center;"> Found Blocks</h4>
<div class="col-12">
<div class="card">
<div class="grid">
<div class="col-12 md:col-4">
<div class="col-12 md:col-2">
<h3>Donate</h3>
<p>Like the project? Consider a donation. </p>
</div>
Expand All @@ -171,7 +171,7 @@ <h3>Donate</h3>
alt="bc1q99n3pu025yyu0jlywpmwzalyhm36tg5u37w20d">
<div>[email protected]</div>
</div>
<div class="col-12 md:col-4 text-center">
<div class="col-12 md:col-6 text-center">
<img style="height: 200px;" src="assets/layout/images/qr-code-onchain.svg"
alt="bc1q99n3pu025yyu0jlywpmwzalyhm36tg5u37w20d">
<div>bc1q99n3pu025yyu0jlywpmwzalyhm36tg5u37w20d</div>
Expand Down

0 comments on commit 36a88b0

Please sign in to comment.