Git Product home page Git Product logo

vue-cli-plugin-docker-nginx-diff-proxy's Introduction

vue-cli-plugin-docker-nginx-diff-proxy

δΈ­ζ–‡ | English

This plug-in is to build a docker image of multiple environment reverse proxy

This is a vue-cli-plugin that adds a minimal docker deployment (~19MB + static files) using nginx to serve your vue-app

prepare: you must have a 'build-proxy' Scripts in your package.json , and 'build-proxy' can build your app to request <proxy_prefix>

Installation

vue add vue-cli-plugin-docker-nginx-diff-proxy

This will automatically add all the files needed to your existing vue-cli project

  1. in your package.json, will add some scripts:

    • docker-build-dev

      Build development environment

    • docker-build-qa

      Build test environment

    • docker-build-pro

      Build production environment

    • docker-run-dev

      Build development environment and Start with 3000 port

    • docker-run-qa

      Build test environment and Start with 3000 port

    • docker-run-pro

      Build production environment and Start with 3000 port

  2. a nginx folder will be added to the root, It contains four files

    • default-dev.conf

      Configuration files for nginx in development environment

    • default-qa.conf

      Configuration files for nginx in test environment

    • default-pro.conf

      Configuration files for nginx in production environment

    • gzip.conf

      _Gzip is on by default,You can close it if you don't need it

  3. in your vue.conf.js,A dockerNginxProxy property will be added to pluginOptions

    • proxy_prefix

      Prefix for reverse proxy, default is '/proxy'

    • env_prefix

      Proxy address of different environment, you can add environment at will

  4. a Dockerfile will be added to the root

    • Dockerfile

      Dynamically load nginx configuration according to Env parameters

Build and run local docker container

npm run docker-run-<ENV>

This will build a docker container and run it on port 3000. If you want to run it on different port change the run script in your package.json to

  "docker-run-<ENV>": "docker run docker-build-<ENV> && docker run -d -p <PORT>:80 <your project>-<ENV>"

Please make sure to have docker installed and running on your machine.

Tweak nginx config

You will find that the three nginx configuration files generated automatically are the same, This is to increase flexibility,You can add and modify any configuration at will in different environments. You can also add templates to support more environments.

vue-cli-plugin-docker-nginx-diff-proxy's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.