Skip to content

Instantly share code, notes, and snippets.

@plodah
Last active December 12, 2025 17:59
Show Gist options
  • Select an option

  • Save plodah/2c91724fe8c7054975a724b9f8d130bc to your computer and use it in GitHub Desktop.

Select an option

Save plodah/2c91724fe8c7054975a724b9f8d130bc to your computer and use it in GitHub Desktop.
Via in docker

a dockerfile for self-hosting Via.

build process is

  • clone Via from github
  • build the site with npm
  • host it in nginx

problems

  • Browsers that I've tested refuse to allow access to WebHID over http For this reason, nginx will listen on both http and https https cert is self-signed for arbitrary name 'node.lan' http still available and is useful if pointing some reverse proxy in
  • paths other than / are likely to 404. Probably fixable with nginx config but haven't bothered
FROM node:latest AS builder
WORKDIR /home/node/app
RUN apt update && apt install git xdg-utils -y
RUN git clone https://github.com/the-via/app .
RUN npm ci && npm install bun node-fetch
RUN npm run build
FROM nginx:latest AS nginx-runner
COPY --from=builder /home/node/app/dist /usr/share/nginx/html
COPY ./nginx-via.conf /etc/nginx/conf.d/viassl.conf
RUN mkdir /etc/nginx/certs
RUN openssl req -x509 -nodes -days 365 -new -newkey rsa:4096 \
-subj "/C=IO/ST=Flux/L=Viapolis/O=Chaos/CN=via.lan" \
-keyout /etc/nginx/certs/nginx.key -out /etc/nginx/certs/nginx.crt
EXPOSE 80/tcp
EXPOSE 443/tcp
CMD [ "nginx", "-g", "daemon off;" ]
server {
listen 443 ssl;
http2 on;
server_name localhost;
ssl_certificate /etc/nginx/certs/nginx.crt;
ssl_certificate_key /etc/nginx/certs/nginx.key;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment