-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (53 loc) · 2.47 KB
/
manual-prod-deploy.yaml
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
54
55
56
57
58
59
name: Manual Production Deployment
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to deploy (v0.33.8)'
required: true
jobs:
deploy-to-prod:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/spot-server:prod-${{ github.event.inputs.tag }}
- name: Deploy to PROD - AWS EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PROD_AWS_SERVER_HOST }}
username: ${{ secrets.PROD_AWS_SERVER_USERNAME }}
password: ${{ secrets.PROD_AWS_SERVER_PASSWORD }}
port: ${{ secrets.PROD_AWS_SERVER_PORT }}
script: |
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/spot-server:prod-${{ github.event.inputs.tag }}
docker stop spot-server-prod || true
docker rm spot-server-prod || true
docker run -d --name spot-server-prod \
-p 8080:8080 \
-p 9292:9292 \
-p 3100:3100 \
-e SPRING_PROFILES_ACTIVE=prod \
-e SPRING_SERVLET_MULTIPART_MAX-FILE-SIZE=30MB \
-e SPRING_SERVLET_MULTIPART_MAX-REQUEST-SIZE=30MB \
-e SPRING_JPA_HIBERNATE_DDL_AUTO=validate \
-e TZ=Asia/Seoul \
-e SENTRY_ENABLE_TRACING=true \
-e SENTRY_ENVIRONMENT=prod \
-e LOKI_URL=${{secrets.LOKI_SERVER_URL}} \
${{ secrets.DOCKERHUB_USERNAME }}/spot-server:prod-${{ github.event.inputs.tag }}
docker system prune -af