-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Fix workflow when pulling docker image
- Loading branch information
1 parent
d137d09
commit 8290bce
Showing
1 changed file
with
29 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,31 +30,33 @@ jobs: | |
runs-on: ubuntu-latest | ||
needs: test | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Decode and save .env file | ||
run: | | ||
echo ${{ secrets.ENV_FILE }} | base64 -d > .env | ||
echo ${{ secrets.ENV_FILE_DEVELOPMENT }} | base64 -d > .env.development | ||
- name: Decode and save .env file | ||
run: | | ||
echo ${{ secrets.ENV_FILE }} | base64 -d > .env | ||
echo ${{ secrets.ENV_FILE_DEVELOPMENT }} | base64 -d > .env.development | ||
- name: Build and Push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ env.IMAGE_NAME }}:latest | ||
- name: Build and Push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
${{ env.IMAGE_NAME }}:latest | ||
${{ env.IMAGE_NAME }}:${{ github.sha }} | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
@@ -63,7 +65,7 @@ jobs: | |
- name: Deploy via SSH | ||
uses: appleboy/[email protected] | ||
env: | ||
ENV: ${{ secrets.ENV}} | ||
ENV: ${{ secrets.ENV }} | ||
with: | ||
host: ${{ secrets.SERVER_HOST }} | ||
username: ${{ secrets.SERVER_USERNAME }} | ||
|
@@ -72,7 +74,8 @@ jobs: | |
envs: ENV | ||
script: | | ||
cd /home/trianggianggara23/app/gh5-backend | ||
git pull github main | ||
docker compose -f docker-compose.yml down | ||
docker compose -f docker-compose.yml up -d | ||
git pull origin main | ||
docker compose down | ||
docker compose pull | ||
docker compose up -d | ||
docker image prune -f |