Skip to content

GustavoContreiras/dockerized-full-stack-environment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dockerized Full-Stack Environment

Introduction

This tutorial will teach you how to setup a dockerized environment that with a single command can run:

  • a MySQL database server (and create and populate a database in it in the first run)
  • a back-end using the NestJS framework with a simple API
  • a front-end using the NextJS framework that calls the back-end API

Folder structure

You can see the most important files and it's locations in the diagram below. Some files were hidden to make it easier to understand.

📦dockerized-full-stack-environment
 ┣ 📂mysql-db
 ┃ ┣ 📜00-create-db.sql
 ┃ ┣ 📜01-create-table-users.sql
 ┃ ┗ 📜02-populate-users-table.sql
 ┣ 📂nestjs-app
 ┃ ┣ 📂node_modules
 ┃ ┣ 📂src
 ┃ ┣ 📂test
 ┃ ┣ 📜.dockerignore
 ┃ ┣ 📜Dockerfile
 ┃ ┣ 📜package.json
 ┃ ┗ 📜webpack-hmr.config.js
 ┣ 📂nextjs-app
 ┃ ┣ 📂node_modules
 ┃ ┣ 📂pages
 ┃ ┣ 📂public
 ┃ ┣ 📂styles
 ┃ ┣ 📜.dockerignore
 ┃ ┣ 📜Dockerfile
 ┃ ┣ 📜package.json
 ┃ ┗ 📜next.config.js
 ┣ 📜.env
 ┣ 📜docker-compose.yml
 ┗ 📜package.json

Install Docker Desktop

Run everything together

Run docker-compose up

Run projects separeted

Run the mysql-db

npm run start:db or  docker-compose up mysql-db

Run the nestjs-app

npm run start:back or  docker-compose up nestjs-app 

Run the nextjs-app

npm run start:front or  docker-compose up nextjs-app

Clean the database volume

Run npm run clean or docker-compose down -v

Please ⭐ if it helped you

Useful links

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published