-
Notifications
You must be signed in to change notification settings - Fork 3
53 lines (44 loc) Β· 1.49 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Deploy Vue.js to EC2
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Build Docker image
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/my-vue-app .
- name: Push Docker image to Docker Hub
run: |
docker push ${{ secrets.DOCKER_USERNAME }}/my-vue-app:latest
# deploy μΉμ
μ μμ νκ±°λ μ£Όμ μ²λ¦¬νμ¬ EC2 λ°°ν¬λ₯Ό μ€μ§ν©λλ€.
# deploy:
# needs: build
# runs-on: ubuntu-latest
# steps:
# - name: Test SSH Connection
# uses: appleboy/[email protected]
# with:
# host: ${{ secrets.EC2_HOST }}
# username: ${{ secrets.EC2_USER }}
# key: ${{ secrets.EC2_KEY }}
# port: 22
# script: |
# echo "SSH connection successful!"
# - name: Deploy to EC2
# uses: appleboy/[email protected]
# with:
# host: ${{ secrets.EC2_HOST }}
# username: ${{ secrets.EC2_USER }}
# key: ${{ secrets.EC2_KEY }}
# port: 22
# script: |
# docker pull ${{ secrets.DOCKER_USERNAME }}/my-vue-app:latest
# docker stop my-vue-app || true
# docker rm my-vue-app || true
# docker run -d -p 80:80 --name my-vue-app ${{ secrets.DOCKER_USERNAME }}/my-vue-app:latest