-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (50 loc) · 1.63 KB
/
Copy pathdeploy-prod.yaml
File metadata and controls
60 lines (50 loc) · 1.63 KB
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
60
name: Deploy to AWS ECR (Prod)
on:
push:
tags:
- 'v*'
env:
AWS_REGION: ap-northeast-2
ECR_REPOSITORY: waffice-prod/waffice-server
ENVIRONMENT: prod
jobs:
deploy:
name: Build and Push to ECR (prod)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata for Docker
id: meta
run: |
echo "timestamp=$(date +%Y%m%d-%H%M%S)" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/arm64
push: true
provenance: false
sbom: false
tags: |
${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ steps.meta.outputs.timestamp }}
build-args: |
ENV=prod
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Image digest
run: |
echo "Image pushed successfully to ${{ env.ENVIRONMENT }}!"
echo "Repository: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}"
echo "Tag: ${{ steps.meta.outputs.timestamp }}"