devforth / spa-to-http

Lightweight zero-configuration SPA HTTP server. Serves SPA bundle on HTTP port so it plays well with Traefik out of the box. Compatible with Vue.js, React and Angular
MIT License
110 stars 8 forks source link

Problem enabling brotli compression when working with remote Docker image #5

Closed ingesa-mel closed 1 year ago

ingesa-mel commented 2 years ago

Hey guys,

your tool really improves my workflow so thank you for that!

However, I have the following issue with enabeling brotli compression:

I follow the below instruction to enable brotli. Due to my setup I don't have a build tag.

trfk-vue: build: "spa" # name of the folder where Dockerfile is located command: --brotli --threshold 500 labels: - "traefik.enable=true" - "traefik.http.routers.trfk-vue.rule=Host(trfk-vue.localhost)" - "traefik.http.services.trfk-vue.loadbalancer.server.port=8080"

But I get the following error from my SPA container:

container exited with code 2 container | panic: lstat proc/1/fd/9: no such file or directory container | goroutine 6 [running]: container | go-http-server/app.(*App).CompressFiles(0x0?) container | /code/app/app.go:103 +0x73 container | created by main.main.func1 container | /code/main.go:19 +0xba

Is this caused by my setup with the image from docker hub?

As a workaround I tried to add the brotli command in my Dockerfile directly, but with no luck.

Thank you for any pointers.

ivictbor commented 1 year ago

Hey, thanks for reminder in contact form. We are not actively maintain it, but using internally a lot. I will ask @LbP22 to help here

LbP22 commented 1 year ago

Hi, thanks for your message! We checked your issue and fixed it, so now it should work for you.

Anyway, here are some guides of simplest implementation of spa-to-http:

  1. https://devforth.io/blog/deploy-react-vue-angular-in-docker-simply-and-efficiently-using-spa-to-http-and-traefik/ - example of usage spa-to-http with traefik
  2. https://github.com/devforth/spa-to-http-demo - demo application
  3. https://drive.google.com/file/d/19d4drkx30HjHxbAEbAsNx9CQXmUBvxAY/view?usp=sharing - small video where I create demo application using tutorial