feat: debug image name
This commit is contained in:
parent
82493003e8
commit
d6547a1b8f
5 changed files with 63 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
|||
name: Builds and Publish Docker Image
|
||||
name: Build and Publish Docker Image
|
||||
description: Define IMAGE_NAME to Git Hub env, based on repository name
|
||||
inputs:
|
||||
username:
|
||||
|
@ -18,6 +18,6 @@ runs:
|
|||
- name: Build Docker Image
|
||||
uses: https://git.lhprovedor.com.br/leandro/forgejo-kaniko-action@v2
|
||||
with:
|
||||
image: ${{ env.IMAGE_NAME }}:${{ github.sha }},${{ env.IMAGE_NAME }}:latest
|
||||
image: ${{ inputs.username }}/${{ env.IMAGE_NAME }}:${{ github.sha }},${{ inputs.username }}/${{ env.IMAGE_NAME }}:latest
|
||||
username: ${{ inputs.username }}
|
||||
password: ${{ inputs.password }}
|
||||
|
|
51
.forgejo/actions/deploy-docker/action.yml
Normal file
51
.forgejo/actions/deploy-docker/action.yml
Normal file
|
@ -0,0 +1,51 @@
|
|||
name: Build and Publish Docker Image
|
||||
description: Define IMAGE_NAME to Git Hub env, based on repository name
|
||||
inputs:
|
||||
username:
|
||||
description: Registry User Name
|
||||
required: true
|
||||
password:
|
||||
description: Registry Password
|
||||
required: true
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Configure SSH
|
||||
uses: webfactory/ssh-agent@v0.9.0
|
||||
with:
|
||||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
|
||||
- name: Configure Staging Server
|
||||
if: github.ref == 'refs/heads/development'
|
||||
shell: sh
|
||||
run: echo demo.lhprovedor.com.br,22 > servidores.lst
|
||||
|
||||
- name: Configure Production Servers
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
|
||||
shell: sh
|
||||
run: |
|
||||
export SERVIDORES=`curl ${{ secrets.URL_SERVIDORES }}`
|
||||
echo "Leandro Servidores: $SERVIDORES"
|
||||
echo $SERVIDORES >> servidores.lst
|
||||
- name: deploy
|
||||
shell: sh
|
||||
run: |
|
||||
for i in `cat servidores.lst`; do
|
||||
IP=`echo $i | cut -d , -f 1`;
|
||||
PORTA=`echo $i | cut -d , -f 2`;
|
||||
echo "----------------------------------------------------------------------------------------"
|
||||
echo "-- Syncing $IP:$PORTA"
|
||||
ssh root@$IP -p $PORTA -o StrictHostKeyChecking=no -t "
|
||||
cd /lh && docker image prune --force &&
|
||||
docker-compose pull --quiet lhisp-dbupdater &&
|
||||
docker-compose pull --quiet $BITBUCKET_REPO_SLUG &&
|
||||
docker-compose up -d --remove-orphans --force-recreate lhisp-dbupdater
|
||||
docker-compose up -d --remove-orphans --force-recreate ${{ env.IMAGE_NAME }}
|
||||
" > $IP-$PORTA.log 2>&1 &
|
||||
done;
|
||||
wait
|
||||
for i in `ls *.log`; do
|
||||
echo "------------------------------------";
|
||||
echo "Arquivo: $i";
|
||||
cat $i;
|
||||
done;
|
|
@ -13,9 +13,10 @@ runs:
|
|||
export REPO_FULL=${{ github.repository }}
|
||||
export REPO_NAME=${REPO_FULL#*/}
|
||||
|
||||
if [ "${{ github.ref_name }}" != "master" && "${{ github.ref_name }}" != "main" ]; then
|
||||
export IMAGE_NAME=${{ inputs.username }}/$REPO_NAME-dev
|
||||
if [ "${{ github.ref_name }}" != "master" ] && [ "${{ github.ref_name }}" != "main" ]; then
|
||||
export IMAGE_NAME=$REPO_NAME-dev
|
||||
else
|
||||
export IMAGE_NAME=${{ inputs.username }}/$REPO_NAME
|
||||
export IMAGE_NAME=$REPO_NAME
|
||||
fi
|
||||
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITHUB_ENV
|
||||
echo "Image Name: $IMAGE_NAME, for Branch: ${{ github.ref_name }}"
|
||||
|
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"cSpell.words": ["dbupdater", "lhprovedor", "webfactory"]
|
||||
}
|
3
force-push.sh
Executable file
3
force-push.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#/bin/sh
|
||||
|
||||
git add .; git commit --amend --no-edit; git push --force; git tag -d v1; git tag v1; git push --force origin v1;
|
Loading…
Add table
Add a link
Reference in a new issue