-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lais Frigério
committed
Apr 12, 2021
1 parent
fc2e735
commit 55f9365
Showing
1 changed file
with
82 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,82 @@ | ||
# boilerplate-docker-node-mysql | ||
A boilerplate Docker project for development with a MySQL database, a Node.js backend using Express | ||
# :copyright: docker + node + mysql boilerplate 💜 | ||
|
||
A boilerplate Docker project for development with a mysql database, a node.js backend using Express | ||
|
||
## 🛠️ Stack | ||
|
||
- nodejs: 14 + express | ||
- mysql: 8.0 | ||
- docker | ||
|
||
### Docker version | ||
|
||
We develop this boilerplate with the following docker version: `19.03.13` | ||
|
||
docker-compose version: `1.29.0` | ||
|
||
## :pencil: Features | ||
|
||
- :ballot_box_with_check: nodejs 14 + express api | ||
- :ballot_box_with_check: mysql 8 database | ||
- :ballot_box_with_check: running this application with docker | ||
|
||
## :gem: Run | ||
|
||
Case if you have a mysql instance running, you must shutdown before run docker container: | ||
|
||
``` | ||
$ sudo service mysql stop | ||
``` | ||
|
||
Then: | ||
|
||
``` | ||
$ cp .env.example .env | ||
$ npm run clean:cache | ||
$ npm run build | ||
$ npm run start:background | ||
``` | ||
|
||
### Stop container | ||
|
||
1) To stop running a container, first execute the following command to get container id: | ||
|
||
``` | ||
docker ps | ||
``` | ||
|
||
2) Copy the container ID and run the following command: | ||
|
||
``` | ||
docker stop <container id> | ||
``` | ||
|
||
### Access mysql database container | ||
|
||
To access the database container, we must get the container id first. Run the following command: | ||
|
||
``` | ||
$ docker ps | ||
``` | ||
|
||
This previous command list all active containers. | ||
|
||
Copy mysql container id and type the following: | ||
|
||
``` | ||
$ docker exec -it <container id> bash | ||
``` | ||
|
||
Then, to access database via line command: | ||
|
||
``` | ||
$ mysql -u <username> -p | ||
``` | ||
|
||
## :woman: Author | ||
|
||
[@laisfrigerio](https://github.com/laisfrigerio/) | ||
|
||
## 📄 License | ||
|
||
This project is licensed under the MIT License - see the LICENSE.md file for details |