-
Notifications
You must be signed in to change notification settings - Fork 1
29 lines (27 loc) · 1.2 KB
/
main.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
name: CI/CD Sapa Mitra Frontend
on:
push:
branches: ["main"]
pull_request:
types: ["closed"]
branches: ["main"]
jobs:
build:
if: github.event_name == 'push' || github.event.pull_request.merged == true
name: Build Frontend
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Insecure Docker Repository
run: |
sudo truncate -s-2 /etc/docker/daemon.json
echo ", \"insecure-registries\": [\"${{ secrets.DOCKER_REGISTRY_URL }}\"]}" | sudo tee -a /etc/docker/daemon.json
sudo systemctl restart docker
- name: Docker Auth
run: docker login ${{ secrets.DOCKER_REGISTRY_URL }} --username=${{ secrets.DOCKER_REGISTRY_USERNAME }} --password=${{ secrets.DOCKER_REGISTRY_PASSWORD }}
- name: Build and Push Docker Image
run: |
docker build --no-cache -t sapa-mitra-frontend -f Dockerfile.production .
docker tag sapa-mitra-frontend ${{ secrets.DOCKER_REGISTRY_URL }}/${{ secrets.DOCKER_REGISTRY_USERNAME }}/sapa-mitra-frontend:latest
docker push ${{ secrets.DOCKER_REGISTRY_URL }}/${{ secrets.DOCKER_REGISTRY_USERNAME }}/sapa-mitra-frontend:latest