Merge pull request #1 from dadosfera/ci/cd

Creating initial CI/CD
This commit is contained in:
Alexsander Pereira
2022-02-04 11:23:41 -03:00
committed by GitHub
2 changed files with 86 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
name: Deploy
on:
push:
branches:
- dev
- stg
- main
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Update Pip
run: |
python3 -m pip install --upgrade pip
- name: Install Docker Compose
run: |
python3 -m pip install docker-compose --upgrade
- name: Install AWS CLI
run: |
python3 -m pip install awscli --upgrade
- name: Install AWS Elastic Beanstalk ClI
run: |
python3 -m pip install awsebcli --upgrade
- name: Configure AWS Region
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-east-1
- name: Extract Environment
shell: bash
run: |
if [ ${GITHUB_REF} == "refs/heads/main" ]; then
echo "##[set-output name=result;]$(echo "prd")"
else
echo "##[set-output name=result;]$(echo ${GITHUB_REF#refs/heads/})"
fi
id: extract_environment
- name: Login to AWS ECR
id: login_ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, Tag, and Push Image to AWS ECR
env:
ENV: ${{ steps.extract_environment.outputs.result }}
IMAGE_TAG: latest
run: |
export ENV=$ENV
docker-compose build
docker-compose push
+28
View File
@@ -0,0 +1,28 @@
version: "3.8"
services:
maestro:
build: .
image: 468720548566.dkr.ecr.us-east-1.amazonaws.com/microservices/maestro_${ENV}:latest
container_name: maestro
restart: always
ports:
- 3333:3333
node_exporter:
image: prom/node-exporter:v1.3.1
container_name: node_exporter
restart: always
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
- /run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:ro
command:
- '--path.procfs=/host/proc'
- '--path.rootfs=/rootfs'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($$|/)'
- '--collector.systemd'
- '--collector.processes'
network_mode: host
pid: host