2021-11-22 19:05:51 +03:00
|
|
|
###
|
|
|
|
# this dockerfile produces image/container that serves customly packaged hubs and admin static files
|
|
|
|
# the result container should serve reticulum as "hubs_page_origin" and "admin_page_origin" on (path) "/hubs/pages"
|
|
|
|
###
|
2022-07-13 20:27:23 +03:00
|
|
|
from node:16.16 as builder
|
2021-11-22 19:05:51 +03:00
|
|
|
run mkdir -p /hubs/admin/ && cd /hubs
|
|
|
|
copy package.json ./
|
|
|
|
copy package-lock.json ./
|
2024-04-10 15:34:08 +03:00
|
|
|
run npm ci --loglevel verbose --legacy-peer-deps
|
2021-11-22 19:05:51 +03:00
|
|
|
copy admin/package.json admin/
|
|
|
|
copy admin/package-lock.json admin/
|
2024-04-10 14:49:33 +03:00
|
|
|
run cd admin && npm ci --loglevel verbose --legacy-peer-deps && cd ..
|
2021-11-22 19:05:51 +03:00
|
|
|
copy . .
|
|
|
|
env BASE_ASSETS_PATH="{{rawhubs-base-assets-path}}"
|
|
|
|
run npm run build 1> /dev/null
|
|
|
|
run cd admin && npm run build 1> /dev/null && cp -R dist/* ../dist && cd ..
|
|
|
|
run mkdir -p dist/pages && mv dist/*.html dist/pages && mv dist/hub.service.js dist/pages && mv dist/schema.toml dist/pages
|
2022-07-28 05:26:11 +03:00
|
|
|
run mkdir /hubs/rawhubs && mv dist/pages /hubs/rawhubs && mv dist/assets /hubs/rawhubs && mv dist/favicon.ico /hubs/rawhubs/pages
|
2021-11-22 19:05:51 +03:00
|
|
|
|
|
|
|
from alpine/openssl as ssl
|
|
|
|
run mkdir /ssl && openssl req -x509 -newkey rsa:2048 -sha256 -days 36500 -nodes -keyout /ssl/key -out /ssl/cert -subj '/CN=hubs'
|
|
|
|
|
|
|
|
from nginx:alpine
|
|
|
|
run apk add bash
|
|
|
|
run mkdir /ssl && mkdir -p /www/hubs && mkdir -p /www/hubs/pages && mkdir -p /www/hubs/assets
|
|
|
|
copy --from=ssl /ssl /ssl
|
|
|
|
copy --from=builder /hubs/rawhubs/pages /www/hubs/pages
|
|
|
|
copy --from=builder /hubs/rawhubs/assets /www/hubs/assets
|
|
|
|
copy scripts/docker/nginx.config /etc/nginx/conf.d/default.conf
|
|
|
|
copy scripts/docker/run.sh /run.sh
|
|
|
|
run chmod +x /run.sh && cat /run.sh
|
|
|
|
cmd bash /run.sh
|