Skip to content

miss55/docker-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installing Node with Docker

About

Resolving Node Multiple Version Issues in Daily Development

Directory Structure

  1. react Scripts and configuration files related to the React project
  2. vue Scripts and configuration files related to the Vue project
  3. Dockerfile Node Docker Build File
  4. Makefile

Build

  1. parameters

    1. NODE_VERSION node version
    2. IMAGE_NAME image name
      • eg NODE_VERSION=20.6.0-alpine3.18 So, let's name the image jenson/node-20.6.`
  2. command

    • make add // Create a default version image
    • make add NODE_VERSION=20.6.0-alpine3.18 IMAGE_NAME=jenson/node-20.6

    The Dockerfile checks the version and automatically selects the appropriate Python version to create. Preferably, choose version 3.15 for building. If you opt for an Alpine version above 3.15, Python will be Python 3. This is mainly to address compatibility issues with previous Node-sass compilation.

  3. Remember the name of the built image, for example: jenson/node-17.5. You will need to use IMAGE_NAME below.

Usage

  1. Choose the appropriate configuration directory based on your project framework, either vue or react.
  2. If the target project already has this file, please add it manually. Otherwise, simply copy it.
  3. According to the comments in env.development.example, configure it into .env.development.
  4. make help show help

Example

  1. make add NODE_VERSION=14-alpine3.17 IMAGE_NAME=jenson/node-14

  2. git clone test project

    • git clone https://github.com/hsl947/react-antd-multi-tabs-admin.git
  3. copy ./react config file

    Please pay attention to .env.development.

  4. set .env.development

      # must
      # IMAGE_NAME="{your generate node}"
      # eg: IMAGE_NAME="jenson/node-20.6"
      IMAGE_NAME="jenson/node-14.21.3"
    
      # must
      #  backend api domain
      # like setupProxy.js proxy
      REACT_APP_HOST_DOMAIN=""
    
      # must
      # Backend api ip, If the domain name used does not resolve
      # Used in dnode.sh to set host
      REACT_APP_HOST_IP=""
    
      # your dev port
      PORT=3000
  5. install node_module make install

    • make install
  6. start make start

    • make start error

      The 'start' property in package.json has already been configured with a port. You can remove it to proceed.

    • make start

      start success, and you can now view multi-tabs-admin in the browser.

    • make start success

About

Resolving Node Multiple Version Issues in Daily Development

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published