Code Monkey home page Code Monkey logo

mern-docker-setup's Introduction

HOW TO USE

This setup has Docker BuildX enabled that means faster builds (using parallel builds) than the default and better caching of your builds!

Easy!

Clone the app

git clone https://github.com/danBamikiya/mern-docker-setup.git

Navigate to the cloned directory

cd mern-docker-setup
  1. Just put the contents of your react folder into the frontend folder.
  2. Put the content of your express folder into the backend folder.
  3. Then replace the database name with your preferred name.
  4. Then use the MongoDB connection URI in your backend as mongodb://mongo:27017/databasename

HOW TO RUN

๐ŸŒฑ Prerequisites

Has been tested on Windows 10 and Linux (Ubuntu 20.04.2 LTS).

You can either work with this project either in Windows, Linux or MacOS. I'll differentiate each environment's working commands in the README with a table like this one:

Action Windows Linux/MacOS
action to run command for windows command for linux/macOS

๐Ÿ Getting started

Commands

All commands are run from the root of the project, from a terminal:

๐Ÿ›Ž๏ธ IMPORTANT: For Windows users, make sure to run the following command in your terminal before running any of the windows commands:

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process

The command above will enable the PowerShell script to run in your current PowerShell terminal without your terminal throwing a security error.

For Linux/MacOS users, you might need to enable the Shell script run like so:

chmod +x ./run.sh
Action Windows Linux/MacOS
Build and start all development services .\run.ps1 Start ./run.sh start
List all services .\run.ps1 LS ./run.sh ls
Stop all services without removing them .\run.ps1 Stop ./run.sh stop
Stop a service without removing it .\run.ps1 Stop-Service *name_of_service* ./run.sh stop_service *name_of_service*
Stop a service and remove it .\run.ps1 Stop-Service *name_of_service* -RM ./run.sh stop_service *name_of_service* RM=true
Pause all services .\run.ps1 Pause ./run.sh pause
Pause a service .\run.ps1 Pause *name_of_service* ./run.sh pause *name_of_service*
Teardown(stop & remove containers, networks & volumes) all services without removing the built images .\run.ps1 Teardown ./run.sh teardown
Teardown(stop & remove containers, networks, volumes & built images) all services and remove the built images .\run.ps1 Teardown -RMI ./run.sh teardown RMI=true
Rebuild and restart a service .\run.ps1 Rebuild-Service *name_of_service* ./run.sh rebuild_service *name_of_service*
Build and start all production services .\run.ps1 Build ./run.sh build
Execute into a service(container) .\run.ps1 Exec-Into *container_name_of_the_service* *other options you may want to provide* ./run.sh exec_into *container_name_of_the_service* *other options you may want to provide*

๐Ÿ“‘ NOTE:

When executing into a service, you provide the container name of the service not the service's name.

Also the execute command is executed as:

Windows Linux/MacOS
docker exec -it $Args /usr/bin/env sh docker exec -it "$@" /usr/bin/env sh

So you don't need to provide the shell to run the command in. Just the container name of the service and any other options you need.

mern-docker-setup's People

Contributors

danbamikiya avatar

Stargazers

Roman avatar Xpan Victor avatar  avatar  avatar

Watchers

 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.