Docker image as DevOps tool for delivery single-page applications
522
Docker image as DevOps tool for delivery single-page applications
docker run
-v `pwd`/build:/var/www \
-e ASSETS=/static \
-e PROXY_FOO_PATH=/api/foo/ \
-e PROXY_FOO_TARGET=https://foo.exapmle.com/api/ \
-e PROXY_BAR_PATH=/api/bar/ \
-e PROXY_BAR_TARGET=https://bar.exapmle.com/api/ \
-e PROXY_BAR_AccessControlAllowOrigin='*' \
noveo/spabox
Create config.yml file (also you can use JSON format):
assets: /static
proxies:
- path: /api/foo/
target: https://foo.exapmle.com/api/
- path: /api/bar/
target: https://bar.exapmle.com/api/
headers:
Access-Control-Allow-Origin: '*'
Run Docker container:
docker run -v `pwd`/config.yml:/spabox/config.yml noveo/spabox
FROM node:10.10.0-alpine as build
WORKDIR /app
COPY package.json .
COPY yarn.lock .
COPY public public
COPY src src
RUN yarn install --production \
&& yarn build
FROM noveo/spabox
COPY --from=build /app/build /var/www
/spabox/config.yml (or /spabox/config.json)
assets property, optional String — expression of nginx location directive.
All matching paths will be cache forever. Warning: if assets is defined, all
mismatching path will be never cache.proxies property, optional Array of Object — array of proxy configs.proxies[].path property, required String — expression of nginx location directive.
Request to all matching paths will be send to proxies[].target.proxies[].target property, required String — nginx proxy_pass directive value.proxies[].headers property, optional Object of String — headers.ASSETS — equals assets property of config file. Case insensitive.PROXY_[a-z0-9]+_PATH — equals proxies[].path property of config file. Case insensitive.PROXY_[a-z0-9]+_TARGET — equals proxies[].target property of config file. Case insensitive.PROXY_[a-z0-9]+_HeaderInCamelCase — equals proxies[].headers['Header-In-Camel-Case']
property of config file. Part of variable name before header name is case insensitive.Content type
Image
Digest
Size
23.9 MB
Last updated
about 7 years ago
docker pull noveo/spabox