diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 581ed20..ff3cb71 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -29,4 +29,18 @@ jobs: IMAGE_TAG: latest run: | docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . - docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \ No newline at end of file + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + - name: Configure SSH + run: | + mkdir -p /.ssh/ + echo "${{secrets.SSH_KEY}}" > ~/.ssh/dev.key + chmod 600 ~/.ssh/dev.key + Host dev + HostName ${{ secrets.INSTANCE_IP_ADDRESS }} + User ${{ secrets.INSTANCE_USER }} + IdentifyFile ~/.ssh/dev.key + StrictHostKeyChecking no + END + - name: Pull and Start + run: | + scp -i ~/.ssh/dev.key -o StrictHostKeyChecking=no -r docker-compose-prod.yml ${{ secrets.INSTANCE_USER }}@${{ secrets.INSTANCE_IP_ADDRESS }}:./ diff --git a/docker-compose-prod.yml b/docker-compose-prod.yml new file mode 100644 index 0000000..3ab7984 --- /dev/null +++ b/docker-compose-prod.yml @@ -0,0 +1,10 @@ +version: "3.8" + +services: + web: + restart: always + container_name: u1_web + ports: + - "80:8000" + image: ${BE_IMAGE} + command: gunicorn u1django.wsgi:application --bind 0.0.0.0:8050 --workers=1 --timeout=60 \ No newline at end of file