Create docker-image_backend_latest_manual.yml

This commit is contained in:
João Vitória Silva
2023-12-22 22:06:09 +00:00
committed by GitHub
parent f24a9d9ca1
commit 37cbe5ba7c

View File

@@ -0,0 +1,28 @@
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Build the backend Docker image
run: |
ls -al
IMAGE_TAG="latest"
docker build . --file Dockerfile_backend --tag ${{ github.repository }}/backend:$IMAGE_TAG
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
- name: Push the backend Docker image to GHCR
if: success() && (github.event_name == 'release' || github.event_name == 'workflow_dispatch')
run: |
echo ${{ secrets.TOKEN_FOR_ACTIONS }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
IMAGE_NAME="ghcr.io/${{ github.repository }}/backend"
docker tag ${{ github.repository }}/backend:$IMAGE_TAG $IMAGE_NAME:$IMAGE_TAG
docker push $IMAGE_NAME:$IMAGE_TAG