Skip to content

Commit

Permalink
Merge pull request #67 from snuhcs-course/feat/tmux_fix
Browse files Browse the repository at this point in the history
Feat/tmux fix
  • Loading branch information
SeongjunJo authored Nov 22, 2023
2 parents c26af58 + e847461 commit 43ae15c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
17 changes: 5 additions & 12 deletions .github/workflows/docker_build_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,19 @@ jobs:
cd backend
docker build -t "${{ secrets.DOCKER_USERNAME }}/haengsha-backend:latest" .
docker push "${{ secrets.DOCKER_USERNAME }}/haengsha-backend:latest"
- name: Stop Docker Container, Clean Up, Pull, Run, and Do ML in Tmux Session
run: |
- name: Deploy to EC2
run: |
set +x
echo "${{ secrets.PEM }}" > key.pem
set -x
chmod 600 key.pem
ssh -i ./"key.pem" -o StrictHostKeyChecking=no ec2-user@${{ secrets.CLOUD_URL }} <<EOF
docker stop haeng
docker rm haeng
echo "Removing unused Docker images..."
docker rmi "${{ secrets.DOCKER_USERNAME }}/haengsha-backend:latest"
echo "Killing all tmux sessions..."
tmux kill-server
echo "Pulling new image..."
tmux kill-server || true
docker pull "${{ secrets.DOCKER_USERNAME }}/haengsha-backend:latest"
docker run -d --name haeng -p 8080:8000 --env-file haengsha-env/.env "${{ secrets.DOCKER_USERNAME }}/haengsha-backend:latest"
tmux new-session -t 0
docker exec -it haeng /bin/bash
bash recommendation_pipeline.sh
tmux detach-client
exit
tmux new-session -d -s ml_session "docker exec haeng /bin/bash -c 'bash recommendation_pipeline.sh'"
EOF
1 change: 0 additions & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ WORKDIR /app

COPY requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
RUN apt-get update && apt-get install -y tmux

COPY . .

Expand Down
3 changes: 1 addition & 2 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: osx-64
# python virtual environment
aiohttp==3.8.6
aiosignal==1.3.1
appnope==0.1.3
Expand Down

0 comments on commit 43ae15c

Please sign in to comment.