how can i build reactjs files in nginx using ansbile and then sync those files into ansible inventory?

Use DockerFile with this parts.

# cat builder.sh
apk update -qq
apk add git -qq
NODE_ENV=development npm install
mkdir dist
- name: Run Container
  docker_container:
    name: "{{ container }}"
    image: "{{ image }}"
    volumes: "{{ lookup('env', 'PWD') }}/app:/app"
    working_dir: "/app"
    recreate: yes
    command: "npm run build:staging"
    state: started
  delegate_to: localhost

- name: Update Frontend
  synchronize:
    src: "{{ lookup('env', 'PWD') }}/{{ component }}/dist/"
    dest: "/{{ parent }}/{{ component }}"
    archive: no
    compress: yes
    recursive: yes
    delete: yes

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top