Skip to content

Commit

Permalink
adjusted prod yml
Browse files Browse the repository at this point in the history
  • Loading branch information
taulant.disha authored and taulant.disha committed May 16, 2024
1 parent 1a95c8c commit b571643
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 32 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,15 @@ jobs:
sudo git checkout main;
sudo git pull origin main;
sudo docker-compose -f docker-compose.yml down
sudo docker rmi $(docker images -f "dangling=true" -q)
sudo docker-compose -f docker-compose.yml pull
sudo docker-compose up -d --build
echo "Stopping and removing specific service: aut_expander_main"
sudo docker-compose stop aut_expander_main
sudo docker-compose rm -f aut_expander_main
echo "Removing dangling images"
sudo docker rmi $(sudo docker images -f "dangling=true" -q) || true
echo "Pulling the new image"
sudo docker-compose pull aut_expander_main
docker-compose up -d --build aut_expander_main
exit 0;
46 changes: 28 additions & 18 deletions .github/workflows/deploy_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,49 +15,59 @@ jobs:
build-and-deploy:
name: Build and Deployment
runs-on: ubuntu-20.04
permissions:
packages: write
contents: read
attestations: write
steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
username: autlabs
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

- name: Build and Push Docker Image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: ../
file: ../Dockerfile
context: .
file: Dockerfile
push: true
tags: ghcr.io/${{ github.actor }}/launchpad:mainnet
tags: autlabs/launchpad:mainnet
build-args:
ENV_FILE: ${{ github.event.inputs.env_file }}
ENV_FILE=${{ github.event.inputs.env_file }}

# Deploy to Server
- name: SSH & Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_SERVER_IP }}
username: ${{ secrets.SSH_SERVER_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
key: ${{ secrets.FRONTEND_SSH_KEY }}
script: |
#!/usr/bin/env bash
# Stop and remove existing containers
echo "Listing directory contents"
ls -l
cd aut-integrate
docker-compose -f docker-compose.prod.yml down
sudo git checkout mainnet;
sudo git pull origin mainnet;
echo "Stopping and removing specific service: aut_expander_mainnet"
sudo docker-compose stop aut_expander_mainnet
sudo docker-compose rm -f aut_expander_mainnet
# Remove dangling images
docker rmi $(docker images -f "dangling=true" -q)
echo "Removing dangling images"
sudo docker rmi $(sudo docker images -f "dangling=true" -q) || true
# Pull and run the new image
docker-compose -f docker-compose.prod.yml pull
GITHUB_USERNAME=${{ github.actor }} docker-compose up -d --build
echo "Pulling the new image"
sudo docker-compose pull aut_expander_mainnet
docker-compose up -d --build aut_expander_mainnet
exit 0;
8 changes: 0 additions & 8 deletions docker-compose.prod.yml

This file was deleted.

10 changes: 8 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
version: "3.7"

services:
aut_expander_dev:
container_name: aut_expander_dev
aut_expander_mainnet:
container_name: aut_expander_mainnet
image: autlabs/launchpad:mainnet
ports:
- "5001:80"

aut_expander_main:
container_name: aut_expander_main
image: autlabs/launchpad:main
ports:
- "5002:80"

0 comments on commit b571643

Please sign in to comment.