Skip to content

Commit

Permalink
docker-image.yml commented
Browse files Browse the repository at this point in the history
  • Loading branch information
italovisconti committed Jul 7, 2024
1 parent 842de35 commit ab8ff44
Showing 1 changed file with 131 additions and 129 deletions.
260 changes: 131 additions & 129 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,134 +1,136 @@
name: Docker Image CI
run-name: Testing - Docker Image CI
# name: Docker Image CI
# run-name: Testing - Docker Image CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# on:
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]

jobs:
testFront:
runs-on: ubuntu-latest
# jobs:
# testFront:
# runs-on: ubuntu-latest

steps:
- name: Metadata
run: |
echo "πŸŽ‰ The job was automatically triggered by a ${{ github.event_name }} event."
echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
echo "πŸ”Ž The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }} (FRONTEND)."
- name: Checkout code
uses: actions/checkout@v4
- name: Check repo
run: |
echo "πŸ’‘ The ${{ github.repository }} repository has been cloned to the runner."
echo "πŸ–₯️ The workflow is now ready to test your code on the runner."
ls ${{ github.workspace }}
- name: Install Node
run: |
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash
sudo apt-get install nodejs -y
node -v
echo "πŸŽ‰ Node has been installed."
- name: Install Dependencies
run: |
cd ${{ github.workspace }}/NNotes
npm install
echo "πŸŽ‰ Frontend app dependencies have been installed"
- name: Run Server
env:
PORT: 3000
DB_URI: "probando"
MODE: "test"
run: |
cd ${{ github.workspace }}/NNotes
nohup npx ts-node src/app.ts &
echo "πŸš€ Server is running on port $PORT"
- name: Wait
run: sleep 12
- name: Run Frontend Tests
run: |
cd ${{ github.workspace }}/NNotes
npm run test
- name: Git Semantic Version
uses: PaulHatch/semantic-version@v4.0.3
with:
major_pattern: "major:"
minor_pattern: "feat:"
format: "${major}.${minor}.${increment}"
id: version
- name: Docker Login
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Build Docker Image
env:
NEW_VERSION: ${{ steps.version.outputs.version }}
run: |
docker build -t delta27222/nnotes_frontend:$NEW_VERSION ./NNotes/
docker build -t delta27222/nnotes_frontend:latest ./NNotes/
- name: Push Docker Image
env:
NEW_VERSION: ${{ steps.version.outputs.version }}
run: |
docker push delta27222/nnotes_frontend:$NEW_VERSION
docker push delta27222/nnotes_frontend:latest
# steps:
# - name: Metadata
# run: |
# echo "πŸŽ‰ The job was automatically triggered by a ${{ github.event_name }} event."
# echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
# echo "πŸ”Ž The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }} (FRONTEND)."
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Check repo
# run: |
# echo "πŸ’‘ The ${{ github.repository }} repository has been cloned to the runner."
# echo "πŸ–₯️ The workflow is now ready to test your code on the runner."
# ls ${{ github.workspace }}
# - name: Install Node
# run: |
# curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash
# sudo apt-get install nodejs -y
# node -v
# echo "πŸŽ‰ Node has been installed."
# - name: Install Dependencies
# run: |
# cd ${{ github.workspace }}/NNotes
# npm install
# echo "πŸŽ‰ Frontend app dependencies have been installed"
# - name: Run Server
# env:
# PORT: 3000
# DB_URI: "probando"
# MODE: "test"
# run: |
# cd ${{ github.workspace }}/NNotes
# nohup npx ts-node src/app.ts &
# echo "πŸš€ Server is running on port $PORT"
# - name: Wait
# run: sleep 12
# - name: Run Frontend Tests
# run: |
# cd ${{ github.workspace }}/NNotes
# npm run test
# - name: Git Semantic Version
# uses: PaulHatch/semantic-version@v4.0.3
# with:
# major_pattern: "major:"
# minor_pattern: "feat:"
# format: "${major}.${minor}.${increment}"
# id: version
# - name: Docker Login
# env:
# DOCKER_USER: ${{ secrets.DOCKER_USER }}
# DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
# run: |
# docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
# - name: Build Docker Image
# env:
# NEW_VERSION: ${{ steps.version.outputs.version }}
# run: |
# docker build -t delta27222/nnotes_frontend:$NEW_VERSION ./NNotes/
# docker build -t delta27222/nnotes_frontend:latest ./NNotes/
# - name: Push Docker Image
# env:
# NEW_VERSION: ${{ steps.version.outputs.version }}
# run: |
# docker push delta27222/nnotes_frontend:$NEW_VERSION
# docker push delta27222/nnotes_frontend:latest

testBack:
runs-on: ubuntu-latest

steps:
- name: Metadata
run: |
echo "πŸŽ‰ The job was automatically triggered by a ${{ github.event_name }} event."
echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
echo "πŸ”Ž The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }} (BACKEND)."
- name: Checkout code
uses: actions/checkout@v4
- name: Check repo
run: |
echo "πŸ’‘ The ${{ github.repository }} repository has been cloned to the runner."
echo "πŸ–₯️ The workflow is now ready to test your code on the runner."
ls ${{ github.workspace }}
- name: Install Node
run: |
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash
sudo apt-get install nodejs -y
node -v
echo "πŸŽ‰ Node has been installed."
- name: Install Dependencies
run: |
cd ${{ github.workspace }}/NNotes-RestAPI
npm install
echo "πŸŽ‰ Backend app dependencies have been installed."
- name: Run Tests
run: |
cd ${{ github.workspace }}/NNotes-RestAPI
npm run test
echo "πŸŽ‰ Backend tests have been executed."
# Hasta aqui llega el test del frontend
- name: Git Semantic Version
uses: PaulHatch/semantic-version@v4.0.3
with:
major_pattern: "major:"
minor_pattern: "feat:"
format: "${major}.${minor}.${increment}"
id: version
- name: Docker Login
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Build Docker Image
env:
NEW_VERSION: ${{ steps.version.outputs.version }}
run: |
docker build -t delta27222/nnotes_backend ./NNotes-RestAPI/
- name: Push Docker Image
env:
NEW_VERSION: ${{ steps.version.outputs.version }}
run: |
docker push delta27222/nnotes_backend
# testBack:
# runs-on: ubuntu-latest

# steps:
# - name: Metadata
# run: |
# echo "πŸŽ‰ The job was automatically triggered by a ${{ github.event_name }} event."
# echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
# echo "πŸ”Ž The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }} (BACKEND)."
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Check repo
# run: |
# echo "πŸ’‘ The ${{ github.repository }} repository has been cloned to the runner."
# echo "πŸ–₯️ The workflow is now ready to test your code on the runner."
# ls ${{ github.workspace }}
# - name: Install Node
# run: |
# curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash
# sudo apt-get install nodejs -y
# node -v
# echo "πŸŽ‰ Node has been installed."
# - name: Install Dependencies
# run: |
# cd ${{ github.workspace }}/NNotes-RestAPI
# npm install
# echo "πŸŽ‰ Backend app dependencies have been installed."
# - name: Run Tests
# run: |
# cd ${{ github.workspace }}/NNotes-RestAPI
# npm run test
# echo "πŸŽ‰ Backend tests have been executed."

# # Hasta aqui llega el test del frontend
# - name: Git Semantic Version
# uses: PaulHatch/semantic-version@v4.0.3
# with:
# major_pattern: "major:"
# minor_pattern: "feat:"
# format: "${major}.${minor}.${increment}"
# id: version
# - name: Docker Login
# env:
# DOCKER_USER: ${{ secrets.DOCKER_USER }}
# DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
# run: |
# docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
# - name: Build Docker Image
# env:
# NEW_VERSION: ${{ steps.version.outputs.version }}
# run: |
# docker build -t delta27222/nnotes_backend ./NNotes-RestAPI/
# - name: Push Docker Image
# env:
# NEW_VERSION: ${{ steps.version.outputs.version }}
# run: |
# docker push delta27222/nnotes_backend

0 comments on commit ab8ff44

Please sign in to comment.