Skip to content

Commit

Permalink
В воркфлоу добавлен шаг сборки образа бэкэнда.
Browse files Browse the repository at this point in the history
  • Loading branch information
eugemos committed Aug 30, 2023
1 parent 46bc216 commit aad7823
Showing 1 changed file with 22 additions and 30 deletions.
52 changes: 22 additions & 30 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,40 +29,32 @@ jobs:
python -m pip install --upgrade pip
pip install flake8==6.0.0
pip install -r ./backend/requirements.txt
- name: Test with flake8 #and django tests
# env:
# POSTGRES_USER: django_user
# POSTGRES_PASSWORD: django_password
# POSTGRES_DB: django_db
# SECRET_KEY: ${{ secrets.SECRET_KEY }}
# DB_HOST: 127.0.0.1
# DB_PORT: 5432
- name: Test with flake8
run: |
cd backend
python -m flake8
# python manage.py test
# build_backend_and_push_to_docker_hub:
# name: Push Docker image to DockerHub
# runs-on: ubuntu-latest
# needs: tests
# if: github.ref == 'refs/heads/main'
# steps:
# - name: Check out the repo
# uses: actions/checkout@v3
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
# - name: Login to Docker
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# - name: Push to DockerHub
# uses: docker/build-push-action@v4
# with:
# context: ./backend/
# push: true
# tags: ${{ secrets.DOCKER_USERNAME }}/kittygram_backend:latest
build_backend_and_push_to_docker_hub:
name: Push Docker image to DockerHub
runs-on: ubuntu-latest
needs: tests
if: github.ref == 'refs/heads/main'
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to DockerHub
uses: docker/build-push-action@v4
with:
context: ./backend/
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/foodgram_backend:latest

# frontend_tests:
# runs-on: ubuntu-latest
Expand Down

0 comments on commit aad7823

Please sign in to comment.