mirror of
https://github.com/Retropex/Ordisrespector-pool-ui.git
synced 2025-05-12 19:20:43 +02:00
feat: docker configuration
This commit is contained in:
parent
41ae76c10e
commit
a563522ec0
4
.dockerignore
Normal file
4
.dockerignore
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
dist
|
||||||
|
node_modules
|
||||||
|
README.md
|
||||||
|
.vscode
|
27
Dockerfile
Normal file
27
Dockerfile
Normal file
@ -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
README.md
14
README.md
@ -37,3 +37,17 @@ Install pm2 (https://pm2.keymetrics.io/)
|
|||||||
```bash
|
```bash
|
||||||
$ pm2 serve --spa dist/public-pool-ui/ 3335 --name ui
|
$ 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
docker/Caddyfile.tpl
Normal file
10
docker/Caddyfile.tpl
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
http://%%DOMAIN%% {
|
||||||
|
root * /var/www/html
|
||||||
|
file_server
|
||||||
|
|
||||||
|
log {
|
||||||
|
output stdout
|
||||||
|
format %%LOGFORMAT%%
|
||||||
|
level %%LOGLEVEL%%
|
||||||
|
}
|
||||||
|
}
|
12
docker/entrypoint.sh
Normal file
12
docker/entrypoint.sh
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user