Skip to content

Commit

Permalink
oper: adicionando rebuild do compose
Browse files Browse the repository at this point in the history
  • Loading branch information
iagocpv committed Nov 4, 2024
1 parent 167c167 commit ed606fc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/deployEC2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ jobs:
run: |
rsync -av --delete --exclude='.git' --exclude='.github' --exclude='.husky' -e "ssh -o StrictHostKeyChecking=no -i key.pem" --rsync-path="sudo rsync" ./ ubuntu@98.80.44.121:/home/ubuntu/tupan-back
- name: Build Docker Compose
run: |
ssh ${{ env.SSH_OPTIONS }} 'cd /home/ubuntu/tupan-back/ && sudo docker-compose build'
- name: Run Docker Compose
run: |
ssh ${{ env.SSH_OPTIONS }} 'cd /home/ubuntu/tupan-back/ && sudo docker-compose up'
ssh ${{ env.SSH_OPTIONS }} 'cd /home/ubuntu/tupan-back/ && sudo docker-compose up -d'
- name: Cleanup SSH key
run: |
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ RUN pip install --upgrade pip && pip install -r requirements.txt
# Copiar o código da aplicação
COPY . /app/

# Expôr a porta que o Django vai usar
EXPOSE 8000

# Criar um script de entrada
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh

# Expôr a porta que o Django vai usar
EXPOSE 8000

# Comando para rodar o script de entrada
CMD ["/app/entrypoint.sh"]

4 changes: 2 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ echo "PostgreSQL está pronto!"

# Rodar migrações
python src/tupan/manage.py makemigrations
python src/tupan/manage.py migrate
python src/tupan/manage.py migrate --noinput

# Iniciar o servidor
python src/tupan/manage.py runserver 0.0.0.0:8000
exec python src/tupan/manage.py runserver 0.0.0.0:8000

0 comments on commit ed606fc

Please sign in to comment.