add assets examples

This commit is contained in:
Umputun
2021-04-13 21:40:09 -05:00
parent de4a6eca64
commit d1ef428236
9 changed files with 42 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
# Assets (static files) server
The example demonstrates how to use reproxy.io for static content serving
- [embed](embed) is a Dockerfile embedding assets into container and serving them with reproxy.
Build it with `docker build -t example .` and run with `docker -it --rm -p 80:80 example`. Hit `http://localhost/index.html` (or `http://localhost`) and `http://localhost/1.html`. Alternatively use `docker-compose build && docker-compose up`
- [external](external) demonstrates how to serve assets from docker's volume (host's file system). The same as above, but you can also edit files inside `assets` and see the changed responses.

View File

@@ -0,0 +1,5 @@
FROM umputun/reproxy:master
ENV TIME_ZONE=America/Chicago
COPY assets /web
EXPOSE 80
CMD ["/srv/reproxy", "--assets.location=/web", "--listen=0.0.0.0:80"]

View File

@@ -0,0 +1 @@
1.html

View File

@@ -0,0 +1 @@
index

View File

@@ -0,0 +1,10 @@
services:
reproxy-embed:
build: .
container_name: reproxy-embed
hostname: reproxy-embed
ports:
- "80:80"
environment:
- LISTEN=0.0.0.0:8080
- ASSETS_LOCATION=/web

4
examples/assets/external/Dockerfile vendored Normal file
View File

@@ -0,0 +1,4 @@
FROM umputun/reproxy:master
ENV TIME_ZONE=America/Chicago
EXPOSE 80
CMD ["/srv/reproxy", "--assets.location=/web", "--listen=0.0.0.0:80"]

View File

@@ -0,0 +1 @@
1.html

View File

@@ -0,0 +1 @@
index

View File

@@ -0,0 +1,12 @@
services:
reproxy-external:
build: .
container_name: reproxy-external
hostname: reproxy-external
ports:
- "80:80"
volumes:
- ./assets:/web
environment:
- LISTEN=0.0.0.0:8080
- ASSETS_LOCATION=/web