From 2b0e909118e3a36ee88aa4bfebf2938a19c9fc8c Mon Sep 17 00:00:00 2001 From: Penny Date: Sat, 2 Nov 2024 16:37:31 +0900 Subject: [PATCH] update docker compose and cicd --- .github/workflows/checks.yml | 30 +++++++++++++++--------------- docker-compose.yml | 4 +++- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index c3f8b2c..e37d08a 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -3,18 +3,18 @@ name: Checks on: [push] jobs: - test-lint: - name: Test and Lint - runs-on: ubuntu-20.04 - steps: - - name: Login to Docker Hub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USER }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Checkout - uses: actions/checkout@v2 - - name: Test - run: docker compose run --rm app sh -c "python manage.py test" - - name: Lint - run: docker compose run --rm app sh -c "flake8" + test-lint: + name: Test and Lint + runs-on: ubuntu-20.04 + steps: + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USER }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Checkout + uses: actions/checkout@v2 + - name: Test + run: docker compose run --rm app sh -c "python manage.py wait_for_db && python manage.py test" + - name: Lint + run: docker compose run --rm app sh -c "flake8" diff --git a/docker-compose.yml b/docker-compose.yml index c121c35..f91f18b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,7 +11,9 @@ services: volumes: - ./app:/app command: > - sh -c "python manage.py runserver 0.0.0.0:8000" + sh -c "python manage.py wait_for_db && + python manage.py migrate && + python manage.py runserver 0.0.0.0:8000" environment: - DB_HOST=db - DB_NAME=devdb