mirror of
https://github.com/Luzifer/gziphttp.git
synced 2024-11-09 16:00:04 +00:00
Add example to README
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
738ab4aa28
commit
17e81d7251
1 changed files with 33 additions and 0 deletions
33
README.md
33
README.md
|
@ -6,3 +6,36 @@
|
|||
# Luzifer / gziphttp
|
||||
|
||||
Very simple HTTP server for serving static files with ability for gzip compression if supported by the client.
|
||||
|
||||
## Usage
|
||||
|
||||
Here is an example usage inside a Docker container containing (quite large) compiled JavaScript files:
|
||||
|
||||
```dockerfile
|
||||
FROM golang:alpine as go
|
||||
|
||||
RUN set -ex \
|
||||
&& apk add git \
|
||||
&& go get -v github.com/Luzifer/gziphttp
|
||||
|
||||
|
||||
FROM node:alpine as node
|
||||
|
||||
COPY . /src
|
||||
WORKDIR /src
|
||||
|
||||
RUN set -ex \
|
||||
&& npm ci \
|
||||
&& npm run build
|
||||
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
COPY --from=go /go/bin/gziphttp /usr/local/bin/
|
||||
COPY --from=node /src/dist /usr/local/share/webtotp
|
||||
|
||||
EXPOSE 3000/tcp
|
||||
CMD ["gziphttp", "-d", "/usr/local/share/webtotp"]
|
||||
```
|
||||
|
||||
In this case `gziphttp` serves compressed files to most (all modern) browsers which ensures the download size of the JavaScript files does not hurt as much as it would without gzip compression.
|
||||
|
|
Loading…
Reference in a new issue