From 65a7c575a166c9b08ff5cacfe2a7026e046a5d0b Mon Sep 17 00:00:00 2001 From: mingi Date: Sat, 28 Sep 2024 20:46:51 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20data.json=20->=20./data.json=20?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EA=B2=BD=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/django_cicd.yml | 10 +++++----- Dockerfile | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/django_cicd.yml b/.github/workflows/django_cicd.yml index ff5ef91..f6eb3ce 100644 --- a/.github/workflows/django_cicd.yml +++ b/.github/workflows/django_cicd.yml @@ -59,7 +59,7 @@ jobs: python manage.py dumpdata > data.json && exit # data.json 을 컨테이너 외부로 복사 - sudo docker cp festival_backend_server:/app/data.json ./data.json && sudo docker rm festival_backend_server:/app/data.json + sudo docker cp festival_backend_server:/app/data.json ./data.json # Docker 로그인 (토큰 사용) echo "${{ secrets.DOCKER_TOKEN }}" | sudo docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin @@ -77,8 +77,8 @@ jobs: # 5. 새로운 컨테이너 시작 sudo docker run --env-file 2024_fall_festival_back/.env -d -p 8000:8000 --name festival_backend_server ${{ secrets.DOCKER_USERNAME }}/festival_backend_image:latest - # data.json 파일을 복사 - sudo docker cp ./data.json festival_backend_server:/app/data.json - # 6. Django 프로젝트의 static 파일 collect - sudo docker exec festival_backend_server python manage.py collectstatic --noinput \ No newline at end of file + sudo docker exec festival_backend_server python manage.py collectstatic --noinput + + # 7. SQLite 데이터 복원 (loaddata) + sudo docker exec festival_backend_server python manage.py loaddata ./data.json \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index b9721d9..47a3b7b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,4 +18,4 @@ COPY . . RUN pip install gunicorn # Django 마이그레이션 실행 후 Gunicorn으로 서버 시작 -CMD ["sh", "-c", "python manage.py migrate && python manage.py loaddata /app/data.json && gunicorn --bind 0.0.0.0:8000 project.wsgi:application"] \ No newline at end of file +CMD ["sh", "-c", "python manage.py migrate && gunicorn --bind 0.0.0.0:8000 project.wsgi:application"] \ No newline at end of file