Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CI/CD Workflow para github actions y docker. Logear la cuenta de dockerhub en el server.
# This is a basic workflow to help you get started with Actions
name: CI/CD
# Controls when the action will run.
on:
push:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/engineering:xml-transactions-api
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- name: CD
uses: garygrossgarten/github-action-ssh@release
with:
command: |
cd /home/centos/api-xml
docker-compose down
docker pull medirec/engineering:xml-transactions-api
docker-compose up -d
host: ${{ secrets.HOST }}
username: centos
passphrase: ${{ secrets.PASSPHRASE }}
privateKey: ${{ secrets.PRIVATE_KEY}}
@tomasmetal23
Copy link
Author

  1. Login docker account in cd server
  2. Configure the necessary commands depending on your need, there is an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment