update path to dockerfile #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image ECR CI | |
on: | |
push: | |
branches: | |
- '**' | |
env: | |
AWS_REGION: eu-central-1 | |
ECR_REPO_URI: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.eu-north-1.amazonaws.com/flask-app | |
DOCKERHUB_URI: ingunnaf | |
IMAGE_NAME: flask-app | |
TAG: latest | |
jobs: | |
# Parts of this comes from https://docs.github.com/en/actions/publishing-packages/publishing-docker-images | |
push_to_registry: | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and Push Docker Image | |
run: | | |
docker build -t ${{ env.IMAGE_NAME }}:${{ env.TAG }} /src/backend/Dockerfile | |
docker tag ${{ env.IMAGE_NAME }}:${{ env.TAG }} ${{ env.DOCKERHUB_URI }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} | |
docker push ${{ env.ECR_REPO_URI }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} | |
# docker-build-push: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v4 | |
# - name: Configure AWS credentials | |
# uses: aws-actions/configure-aws-credentials@v4 | |
# with: | |
# role-to-assume: ${{ secrets.AWS_IAM_ROLE }} | |
# aws-region: ${{ env.AWS_REGION }} | |
# - name: Login to Amazon ECR | |
# run: | | |
# aws ecr get-login-password \ | |
# --region ${{ env.AWS_REGION }} \ | |
# | docker login \ | |
# --username AWS \ | |
# --password-stdin ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com | |
# - name: Log in to Dockerhub | |
# uses: | |
# - name: Build and Push Docker Image | |
# run: | | |
# docker build -t ${{ env.IMAGE_NAME }}:${{ env.TAG }} . | |
# docker tag ${{ env.IMAGE_NAME }}:${{ env.TAG }} ${{ env.ECR_REPO_URI }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} | |
# docker push ${{ env.ECR_REPO_URI }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} | |