-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (29 loc) · 952 Bytes
/
cicd.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
name: Deploy to AWS EC2
on:
push:
branches:
- feature/https-setting
jobs:
build:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set .ENV file
run: echo "API_HOST=${{ secrets.API_HOST }}" > .env
- name: Build docker image
run: docker build -t sonny2024/polabo-fe .
- name: Login to DockerHub
run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
- name: Push to DockerHub
run: docker push sonny2024/polabo-fe:latest
deploy:
needs: build
runs-on: self-hosted
steps:
- name: Pull from DockerHub
run: docker pull sonny2024/polabo-fe:latest
- name: Delete existing container
run: docker rm -f polabo-fe || true
- name: Run container
run: docker run -d -p 3000:3000 --name polabo-fe sonny2024/polabo-fe:latest