72 lines
1.2 KiB
Markdown
72 lines
1.2 KiB
Markdown
# NodeJS Project
|
|
This is a template project for NodeJS projects.
|
|
|
|
## Setup
|
|
- Clone the repository: `git clone <repo_url>`
|
|
- Copy `example.env` to `.env`
|
|
- Configure `.env`
|
|
- You're done
|
|
|
|
## Start
|
|
- Run `docker compose up -d`
|
|
- Check if everything is working
|
|
- You're done
|
|
|
|
## Run commands in container
|
|
|
|
### If the container is running
|
|
```sh
|
|
docker compose exec nodejs <your_command>
|
|
```
|
|
|
|
### If the container is not running
|
|
```sh
|
|
docker compose run --rm nodejs <your_command>
|
|
```
|
|
|
|
## Other commands
|
|
|
|
### Rebuild container
|
|
```sh
|
|
docker compose build
|
|
```
|
|
|
|
### Init git submodules (if any)
|
|
```sh
|
|
git submodule update --init --recursive
|
|
```
|
|
|
|
### Update git submodule
|
|
```sh
|
|
# Enter the submodule directory
|
|
cd <submodule_folder>
|
|
# Pull the other repo
|
|
git pull
|
|
# Go back to the root directory of the project
|
|
cd ..
|
|
# Check update
|
|
git status
|
|
# Commit update
|
|
git add <submodule_folder>
|
|
git commit -m "Submodule updated"
|
|
```
|
|
|
|
### Update git submodule (other method)
|
|
```sh
|
|
git submodule update --remote --merge
|
|
```
|
|
|
|
### Add git submodule
|
|
```sh
|
|
git submodule add <url>
|
|
# or
|
|
git submodule add <url> <path>
|
|
```
|
|
|
|
### Remove git submodule
|
|
```sh
|
|
git submodule deinit -f <path>
|
|
git rm -f <path>
|
|
rm -rf .git/modules/<path>
|
|
```
|