Closed joseamtalavera closed 1 month ago
Create Dockerfile client/Dockerfile
Create Dockerfile server/Dockerfile
Create docker-compose.yml
do not include or copy node-modules using: .dockerignore
Build Docker Image: docker-compose build
Run Docker container: docker-compose up --build -d
sudo apt update sudo apt install docker.io -y sudo systemctl start docker sudo systemctl enable docker sudo usermod -aG docker $USER newgrp docker docker --version
sudo apt install docker-compose
Logging in to Git Hub Container Registry - GHCR
token | docker login ghcr.io -u joseamtalavera --password-stdin
Before logging you need to build the changes in local:
docker build --build-arg REACT_APP_API_URL=https://app.lhainmobiliaria.es -t ghcr.io/joseamtalavera/lhm_inmo_app-frontend:latest ./client docker build -t ghcr.io/joseamtalavera/lhm_inmo_app-backend:latest ./server
docker tag lhm_inmo_app-frontend:latest ghcr.io/joseamtalavera/lhm_inmo_app-frontend:latest docker tag lhm_inmo_app-backend:latest ghcr.io/joseamtalavera/lhm_inmo_app-backend:latest
docker push ghcr.io/joseamtalavera/lhm_inmo_app-frontend:latest docker push ghcr.io/joseamtalavera/lhm_inmo_app-backend:latest
Before I need to login inside the EC2:
Pull and Run all together more efficiently:
docker-compose -f docker-compose.prod.yml down docker-compose -f docker-compose.prod.yml pull docker-compose -f docker-compose.prod.yml up -d
docker ps docker-compose -f docker-compose.prod.yml logs -f
.....From this point, we carry on with the normal configuration in the EC2
The flow is as follows:
docker system prune -a --volumes
Starting Point in Local Machine
Create Dockerfile client/Dockerfile
Create Dockerfile server/Dockerfile
Create docker-compose.yml
do not include or copy node-modules using: .dockerignore
Build Docker Image: docker-compose build
Run Docker container: docker-compose up --build -d
Installing Dockers in EC2
sudo apt update sudo apt install docker.io -y sudo systemctl start docker sudo systemctl enable docker sudo usermod -aG docker $USER newgrp docker docker --version
sudo apt install docker-compose
Connecting and Push to GitHub Container Registry (GHCR)
Logging in to Git Hub Container Registry - GHCR
token | docker login ghcr.io -u joseamtalavera --password-stdin
Before logging you need to build the changes in local:
docker build --build-arg REACT_APP_API_URL=https://app.lhainmobiliaria.es -t ghcr.io/joseamtalavera/lhm_inmo_app-frontend:latest ./client docker build -t ghcr.io/joseamtalavera/lhm_inmo_app-backend:latest ./server
docker tag lhm_inmo_app-frontend:latest ghcr.io/joseamtalavera/lhm_inmo_app-frontend:latest docker tag lhm_inmo_app-backend:latest ghcr.io/joseamtalavera/lhm_inmo_app-backend:latest
docker push ghcr.io/joseamtalavera/lhm_inmo_app-frontend:latest docker push ghcr.io/joseamtalavera/lhm_inmo_app-backend:latest
Pull and Run the images from the EC2
Before I need to login inside the EC2:
token | docker login ghcr.io -u joseamtalavera --password-stdin
Pull and Run all together more efficiently:
docker-compose -f docker-compose.prod.yml down docker-compose -f docker-compose.prod.yml pull docker-compose -f docker-compose.prod.yml up -d
docker ps docker-compose -f docker-compose.prod.yml logs -f
.....From this point, we carry on with the normal configuration in the EC2
Very Important
The flow is as follows:
Clean space from the Docker
docker system prune -a --volumes