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
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.
📦web-authentication-with-aws-rekognition
┣ 📂mysql-db
┃ ┣ 📜00-create-db.sql
┃ ┗ 📜01-create-table-users.sql
┣ 📂nestjs-app
┃ ┣ 📂node_modules
┃ ┣ 📂src
┃ ┣ 📂test
┃ ┣ 📜.dockerignore
┃ ┣ 📜Dockerfile
┃ ┣ 📜package.json
┃ ┗ 📜webpack-hmr.config.js
┣ 📂nextjs-app
┃ ┣ 📂node_modules
┃ ┣ 📂pages
┃ ┃ ┗ 📜index.tsx
┃ ┣ 📂public
┃ ┣ 📂styles
┃ ┣ 📜.dockerignore
┃ ┣ 📜Dockerfile
┃ ┣ 📜package.json
┃ ┗ 📜next.config.js
┣ 📜.env
┣ 📜docker-compose.yml
┗ 📜package.json
- Sign in AWS
- Go to IAM service
- Click in
Users
- Select the desired user
- Click in
Create access key
- Follow the steps
- Copy the generated Access Key and Secret Key to use on the next step
- Run
aws configure
- Set your Access Key and Secret Key
- https://docs.docker.com/desktop/install/windows-install/
- https://docs.docker.com/desktop/install/linux-install/
- https://docs.docker.com/desktop/install/mac-install/
Run docker-compose up
npm run start:db
or
docker-compose up mysql-db
npm run start:back
or
docker-compose up nestjs-app
npm run start:front
or
docker-compose up nextjs-app
Run npm run clean
or docker-compose down -v