Skip to content

Commit

Permalink
test deploy to production15
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegGsk committed Sep 25, 2024
1 parent 4512e64 commit 27a3d35
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 29 deletions.
33 changes: 16 additions & 17 deletions .github/workflows/production_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,34 +93,33 @@ jobs:
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}

deploy:
name: Deploy changes on server
runs-on: ubuntu-latest
environment:
name: prod_deploy
# needs: [pytest, code_style_pep8, build_and_push]
steps:
deploy:
name: Deploy changes on server
runs-on: ubuntu-latest
environment:
name: prod_deploy
# needs: pytest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: feature/convert_ci-cd_to_the_prod
# with:
# ref: dev

- name: Set up SSH
run: |
mkdir -p ~/.ssh
chmod 700 ~/.ssh
# Указываем параметры команды ssh-keyscan:
ssh-keyscan -H ${{ secrets.HOST }} -t rsa > ~/.ssh/known_hosts
ssh-keyscan -H ${{ secrets.HOST }} > ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
echo "${{ secrets.TEST_RSA_SECRET_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa@${{ secrets.HOST }} mkdir -p ${{ env.DEPLOY_PATH }}/infra
chmod 600 ~/.ssh/id_rsa
- name: Create folder for deploy
run: ssh -vvv ${{ secrets.USERNAME }}@${{ secrets.HOST }} mkdir -p ${{ env.DEPLOY_PATH }}/infra

- name: Copy dev folder to VPS
run: |
# scp -r $GITHUB_WORKSPACE/infra/prod/ ${{ secrets.USERNAME }}@${{ secrets.HOST }}:${{ env.DEPLOY_PATH }}/infra/
# scp -r $GITHUB_WORKSPACE/infra/nginx/ ${{ secrets.USERNAME }}@${{ secrets.HOST }}:${{ env.DEPLOY_PATH }}/infra/
scp -r $GITHUB_WORKSPACE/infra/prod/ ${{ secrets.USERNAME }}@${{ secrets.HOST }}:${{ env.DEPLOY_PATH }}/infra/
scp -r $GITHUB_WORKSPACE/infra/nginx/ ${{ secrets.USERNAME }}@${{ secrets.HOST }}:${{ env.DEPLOY_PATH }}/infra/
- name: Execute commands on VPS
uses: appleboy/ssh-action@master
Expand All @@ -129,7 +128,7 @@ jobs:
username: ${{ secrets.USERNAME }}
key: ${{ secrets.TEST_RSA_SECRET_KEY }}
script: |
cd prodiction/${{ env.DEPLOY_PATH }}
cd ${{ env.DEPLOY_PATH }}
rm .env
touch .env
Expand Down
19 changes: 7 additions & 12 deletions infra/prod/prod.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
FROM python:3.11-slim-bullseye AS builder
FROM python:3.11

WORKDIR /app
COPY poetry.lock pyproject.toml ./

RUN python -m pip install --no-cache-dir poetry==1.6.1 \
&& poetry config virtualenvs.in-project true \
&& poetry install --without dev --with test
COPY requirements/production.txt .
RUN pip install -r production.txt --no-cache-dir

FROM python:3.11-slim-bullseye
COPY . .

# COPY entrypoint.sh /entrypoint.sh
# RUN chmod +x /entrypoint.sh
COPY --from=builder /app /app
COPY adaptive_hockey_federation/ ./
# ENTRYPOINT ["/entrypoint.sh"]
WORKDIR /app/adaptive_hockey_federation

CMD ["/app/.venv/bin/gunicorn", "adaptive_hockey_federation.wsgi:application", "--bind", "0:8000" ]

CMD ["gunicorn", "core.wsgi:application", "--bind", "0:8000" ]

0 comments on commit 27a3d35

Please sign in to comment.